Closed antoyo closed 4 years ago
Install debug symbols for GTK and GLib/GObject please, then we would know the lines where things go wrong here and that should make it clear what happens :)
gtk_window_set_application()
causes some signal to be emitted and a signal handler on that signal is exploding.
Proper backtrace for reference:
Thread 1 (Thread 0x7ffff580cb80 (LWP 63334)):
#0 gtk_application_impl_window_added (impl=0x0, window=0x555555644530 [GtkWindow]) at ../../../../gtk/gtkapplicationimpl.c:90
#1 0x00007ffff790e7b8 in gtk_application_window_added (application=application@entry=0x5555555fc0f0 [GtkApplication], window=window@entry=0x555555644530 [GtkWindow]) at ../../../../gtk/gtkapplication.c:438
#2 0x00007ffff73392ff in g_cclosure_marshal_VOID__OBJECTv (closure=0x5555555fb510, return_value=<optimized out>, instance=<optimized out>, args=<optimized out>, marshal_data=<optimized out>, n_params=<optimized out>, param_types=0x5555555fb560) at ../../../gobject/gmarshal.c:1910
#3 0x00007ffff7336206 in _g_closure_invoke_va (closure=0x5555555fb510, return_value=0x0, instance=0x5555555fc0f0, args=0x7fffffffd8a0, n_params=1, param_types=0x5555555fb560) at ../../../gobject/gclosure.c:873
#4 0x00007ffff73548d4 in g_signal_emit_valist (instance=0x5555555fc0f0, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffd8a0) at ../../../gobject/gsignal.c:3407
#5 0x00007ffff7354edf in g_signal_emit (instance=<optimized out>, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3554
#6 0x00007ffff790f222 in gtk_application_add_window (application=<optimized out>, window=window@entry=0x555555644530 [GtkWindow]) at ../../../../gtk/gtkapplication.c:976
#7 0x00007ffff7b95ac0 in gtk_window_set_application (window=0x555555644530 [GtkWindow], application=0x5555555fc0f0 [GtkApplication]) at ../../../../gtk/gtkwindow.c:3569
#8 0x000055555555d1c7 in <O as gtk::auto::window::GtkWindowExt>::set_application (self=0x555555742ed8, application=...) at /home/slomo/.cargo/git/checkouts/gtk-b89af3a825b1a0bb/b0a081e/src/auto/window.rs:1573
#9 0x000055555555cd25 in bah::main::{{closure}}::{{closure}} () at src/main.rs:31
#10 0x000055555555e226 in glib::source::trampoline (func=0x555555742ed0, func@entry=<error reading variable: value has been optimized out>) at /home/slomo/.cargo/git/checkouts/glib-928cf7b282977403/0f--Type <RET> for more, q to quit, c to continue without paging--
48fab/src/source.rs:90
#11 0x00007ffff724c054 in g_timeout_dispatch (source=0x5555557a4690, callback=<optimized out>, user_data=<optimized out>) at ../../../glib/gmain.c:4800
#12 0x00007ffff724b4de in g_main_dispatch (context=0x5555555fdbf0) at ../../../glib/gmain.c:3309
#13 g_main_context_dispatch (context=context@entry=0x5555555fdbf0) at ../../../glib/gmain.c:3974
#14 0x00007ffff724b890 in g_main_context_iterate (context=0x5555555fdbf0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4047
#15 0x00007ffff724bb63 in g_main_loop_run (loop=0x5555555fdbb0) at ../../../glib/gmain.c:4241
#16 0x00007ffff7a38e85 in gtk_main () at ../../../../gtk/gtkmain.c:1328
#17 0x000055555556182a in gtk::auto::functions::main () at /home/slomo/.cargo/git/checkouts/gtk-b89af3a825b1a0bb/b0a081e/src/auto/functions.rs:314
The reason is that priv->impl
of GtkApplication
is not initialized yet. It would only be once startup
has run. This is a bug in GTK IMHO, it should at least get a guard against this situation to not crash. Inside gtk_application_window_added()
In theory this piece of code in gtk_application_add_window()
should prevent it already but apparently doesn't:
if (!g_application_get_is_registered (G_APPLICATION (application)))
{
g_critical ("New application windows must be added after the "
"GApplication::startup signal has been emitted.");
return;
}
Please report to GTK here: https://gitlab.gnome.org/GNOME/gtk/issues/new
Hi. The following code cause a segfault:
Here's the stacktrace:
I'm not sure exactly what is causing this. It might be because
set_application()
is called from outside the context of theactivate
signal.