[gnome-terminal] crash on GtkApplication shutdown
Submitted by Christian Persch
This is a bug in the interplay between GtkApplication's and GApplication's shutdown sequencing.
https://bugzilla.redhat.com/show_bug.cgi?id=1525083 is a crash in gnome-terminal. As you can see from the backtrace [https://bugzilla.redhat.com/attachment.cgi?id=1366767], the gtk_application_add_window() call on a newly created window crashes down in gtk_application_impl_window_added() because the GtkApplication's impl pointer is NULL.
Looking further down the stack, we see:
#14 0x0000559327d1580d in terminal_factory_impl_create_instance (factory=0x5593284a6270, invocation=0x55932851a5d0, options=0x5593285340a0) at terminal-gdbus.c:436 [...] #23 0x00007f89274d93dc in call_in_idle_cb (user_data=user_data@entry=0x55932851a5d0) at gdbusconnection.c:4851 [...] #28 0x00007f8926f00272 in g_main_loop_run (loop=0x5593289f2c50) at gmain.c:4082 #29 0x00007f8928e2e6ce in gtk_clipboard_real_store (clipboard=0x559328539560) at #30 0x00007f8928e3026f in _gtk_clipboard_store_all () at gtkclipboard.c:2211 #31 0x00007f8928b95c49 in gtk_application_shutdown #36 0x00007f89274bcda2 in g_application_run (application=0x5593284ed0d0, [...] #37 0x0000559327d101fd in main (argc=<optimized out>, argv=<optimized out>) at
So the application was in shutdown, and storing the clipboard runs a mainloop. While that was running, a new request came in from dbus to create a new window.
Note that gnome-terminal's GtkApplication uses dbus_register/unregister to install its own dbus interface.
Running the mainloop to store the clipboard should not still process dbus requests; clearly the dbus_unregister vfunc (in GApplication) is called too late, or storing the clipboard (in GtkApplication) is called to early in the shutdown sequence.