Crash using floating dialog immediately after closing second window
Reported with F&S dialog, and Document Properties dialog (mentioned in inkscape!3700 (merged) iirc, definitely discussed it with Mike during testing), and Swatches dialog (with swatches set), Transform dialog, Align and Distribute dialog, Icon preview dialog crashes on closing exit, and then I couldn't be bothered to test anymore dialogs.
Steps to reproduce:
- Open Inkscape
- Open Fill and Stroke dialog
- Undock
- Open new window
- Create path
- Change stroke width
- Close window
- Without clicking on the first window, select the F&S dialog
- Try to change stroke width (it should still be editable)
What happened?
- The title bar of the dialog doesn't change (and still says New Document 2)
- While I can't be sure all dialogs crash, this buggy behavior should happen in all dialogs and should indicate the problem is happening.
- Crash
Here's a backtrace with the Document Properties dialog and changing the Width (because it takes too long for the stack to be printed for the F&S dialog crash)
Thread 1 "inkscape" received signal SIGSEGV, Segmentation fault.
0x00007ffff72f3a54 in Inkscape::UI::Dialog::DialogWindow::on_key_press_event (this=0x55555c2ca630, key_event=0x55555e22bb60) at ../src/inkscape-application.h:86
86 InkscapeWindow* get_active_window() { return _active_window; }
(gdb) set pagination off
(gdb) bt
#0 0x00007ffff72f3a54 in Inkscape::UI::Dialog::DialogWindow::on_key_press_event(_GdkEventKey*) (this=0x55555c2ca630, key_event=0x55555e22bb60) at ../src/inkscape-application.h:86
#1 0x00007ffff46f6fe9 in Gtk::Widget_Class::key_press_event_callback(_GtkWidget*, _GdkEventKey*) () at widget.cc:4482
#2 0x00007ffff3e3636f in _gtk_marshal_BOOLEAN__BOXEDv (closure=0x55555561be50, return_value=0x7fffffffd980, instance=<optimised out>, args=<optimised out>, marshal_data=<optimised out>, n_params=<optimised out>, param_types=0x555555612080) at gtkmarshalers.c:129
#3 0x00007ffff4fc6a56 in _g_closure_invoke_va (closure=0x55555561be50, return_value=0x7fffffffd980, instance=0x55555c18c540, args=0x7fffffffda50, n_params=1, param_types=0x555555612080) at ../../../gobject/gclosure.c:873
#4 0x00007ffff4fe4df1 in g_signal_emit_valist (instance=0x55555c18c540, signal_id=<optimised out>, detail=<optimised out>, var_args=var_args@entry=0x7fffffffda50) at ../../../gobject/gsignal.c:3408
#5 0x00007ffff4fe60f3 in g_signal_emit (instance=instance@entry=0x55555c18c540, signal_id=<optimised out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3555
#6 0x00007ffff3de09b3 in gtk_widget_event_internal (event=0x55555e22bb60, widget=0x55555c18c540 [gtkmm__GtkWindow]) at ../../../../gtk/gtkwidget.c:7808
#7 gtk_widget_event_internal (widget=0x55555c18c540 [gtkmm__GtkWindow], event=0x55555e22bb60) at ../../../../gtk/gtkwidget.c:7677
#8 0x00007ffff3c9bf8f in propagate_event (widget=0x55555c18c540 [gtkmm__GtkWindow], event=0x55555e22bb60, captured=<optimised out>, topmost=0x0) at ../../../../gtk/gtkmain.c:2690
#9 0x00007ffff3c9e18b in gtk_main_do_event (event=0x55555e22bb60) at ../../../../gtk/gtkmain.c:1920
#10 gtk_main_do_event (event=<optimised out>) at ../../../../gtk/gtkmain.c:1690
#11 0x00007ffff3986f69 in _gdk_event_emit (event=event@entry=0x55555e22bb60) at ../../../../gdk/gdkevents.c:73
#12 0x00007ffff39ba0f6 in gdk_event_source_dispatch (source=<optimised out>, callback=<optimised out>, user_data=<optimised out>) at ../../../../../gdk/x11/gdkeventsource.c:367
#13 0x00007ffff60c517d in g_main_dispatch (context=0x555555606970) at ../../../glib/gmain.c:3309
#14 g_main_context_dispatch (context=context@entry=0x555555606970) at ../../../glib/gmain.c:3974
#15 0x00007ffff60c5400 in g_main_context_iterate (context=context@entry=0x555555606970, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimised out>) at ../../../glib/gmain.c:4047
#16 0x00007ffff60c54a3 in g_main_context_iteration (context=context@entry=0x555555606970, may_block=may_block@entry=1) at ../../../glib/gmain.c:4108
#17 0x00007ffff50f4fe5 in g_application_run (application=0x555555661210 [gtkmm__GtkApplication], argc=<optimised out>, argv=<optimised out>) at ../../../gio/gapplication.c:2559
#18 0x0000555555557364 in main(int, char**) (argc=<optimised out>, argv=<optimised out>) at /usr/include/glibmm-2.4/glibmm/refptr.h:405
(gdb) frame 0
#0 0x00007ffff72f3a54 in Inkscape::UI::Dialog::DialogWindow::on_key_press_event (this=0x55555c2ca630, key_event=0x55555e22bb60) at ../src/inkscape-application.h:86
86 InkscapeWindow* get_active_window() { return _active_window; }
(gdb) p _app
$1 = (InkscapeApplication *) 0x5555555b85e0
(gdb) p _app->get_active_window()
Cannot evaluate function -- may be inlined
(gdb) p _app->_active_window
$2 = (InkscapeWindow *) 0x0
What should have happened?
- No crash, the dialog is properly attached to the active window (which should be set).
Version info
Bisection points to inkscape@0ee97641
commit 0ee976412bd40b76df85cd7ef7bf588a40336e33
Author: Tavmjong Bah <tavmjong@free.fr>
Date: Fri Oct 22 19:33:43 2021 +0000
Move code to check for data loss on closing a window to an independent file.