GtkApplication causes warnings about thread-unsafe use of unsetenv
I'm updating roxterm to use GtkApplication, and if I run it with G_DEBUG_MESSAGES=all I get this warning:
(roxterm:19001): GLib-DEBUG: 18:17:36.928: unsetenv() is not thread-safe and should not be used after threads are created
I got this backtrace (using GTK 3.24.16 for easy access to debugging symbols in Arch, but it's also present in the current official Arch package, 3.24.17+29+g85389c4b-1):
(gdb) break unsetenv
Breakpoint 2 at 0x7ffff6f511e0
(gdb) cont
Continuing.
Breakpoint 2, 0x00007ffff6f511e0 in unsetenv () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff6f511e0 in unsetenv () at /usr/lib/libc.so.6
#1 0x00007ffff77d6acd in gdk_get_desktop_startup_id () at ../gtk/gdk/gdk.c:1184
#2 0x00007ffff7242424 in g_type_create_instance (type=<optimized out>)
at ../glib/gobject/gtype.c:1861
#3 0x00007ffff726067e in g_object_new_internal
(class=class@entry=0x555555636e20, params=params@entry=0x7fffffffdc80, n_params=n_params@entry=2) at ../glib/gobject/gobject.c:1937
#4 0x00007ffff7261309 in g_object_new_valist
(object_type=<optimized out>, first_property_name=<optimized out>, var_args=var_args@entry=0x7fffffffddd0) at ../glib/gobject/gobject.c:2262
#5 0x00007ffff7261c7a in g_object_new
(object_type=<optimized out>, first_property_name=<optimized out>)
at ../glib/gobject/gobject.c:1780
#6 0x00005555555804ee in roxterm_app_get ()
at /home/tony/Code/roxterm/src/roxterm-app.c:272
#7 0x0000555555566215 in main (argc=2, argv=0x7fffffffdfc8)
at /home/tony/Code/roxterm/src/roxterm-app.c:379
(gdb) quit
I think some functions have been optimised out and that it's actually gtk_application_init()
calling this. I can't make it go away even if construct the GtkApplication-based object on the very first line of main()
. Roxterm doesn't use threading explicitly, but one of the packages it depends on presumably does: vte-2.91 gtk+-3.0 gmodule-export-2.0
. (I added the gmodule-export-2.0 some time ago because GtkBuilder needed it, but I haven't checked whether that's still necessary).
I also get two similar messages in each terminal I open, except they refer to setenv()/putenv()
instead of unsetenv()
. That's probably something to do with Vte's wrapper for the child process.