Crash hiding scrollbar after opening/closing a few times

Steps to reproduce:

  • open Inkscape
  • Ctrl+N (new window)
  • Ctrl+B (hide scrollbar)
  • Ctrl+W (close document and thus window)
  • Repeat last 3 steps 3-4 times. Ctrl+B will show (not hide) the scrollbar every second time

What happened?

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f08a2729ee2 in __dynamic_cast ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
[Current thread is 1 (Thread 0x7f089bcdcb40 (LWP 219009))]
(gdb) set pagination off
(gdb) bt
#0  0x00007f08a2729ee2 in __dynamic_cast () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00007f08a3a6e2f8 in set_menuitems(unsigned int, bool) (emitting_verb=193, value=<optimised out>) at ../src/ui/desktop/menubar.cpp:124
... (sigc signal stuff)
#7  SPDesktop::toggleScrollbars() (this=this@entry=0x555907936540) at ../src/desktop.cpp:1346

What should have happened?

  • No crash

Sample attachments: inkscape-backtrace-hide-scrollbar.txt and inkscape-scrollbar

Version Info:

  • Inkscape 1.0.1 (179fe94779, 2021-01-06) Linux Mint 20
  • Inkscape 1.1-dev (8d201ce056, 2021-01-09) Linux Mint 20

Bisection points to commit inkscape@a7e562fc

Author: Jabiertxof <jabier.arraiza@marker.es>
Date:   Sun Jul 28 18:59:09 2019 +0200

    Add Patrick improvements to verbs toggle menu items
 src/desktop.cpp                | 21 ++++++++++----------
 src/desktop.h                  |  2 +-
 src/object/sp-namedview.cpp    |  5 +++--
 src/object/sp-namedview.h      |  2 +-
 src/ui/desktop/menubar.cpp     | 45 ++++++++++++++++++++++--------------------
 src/ui/desktop/menubar.h       |  1 +
 src/verbs.cpp                  |  2 +-
 src/widgets/desktop-widget.cpp |  2 +-
 8 files changed, 43 insertions(+), 37 deletions(-)

Relevant MRs: inkscape!803 (merged) and subsequently inkscape!800 (merged)

Note: earlier commits only required 2 Ctrl+N to replicate the issue.

Edited by Nathan Lee