Skip to content

st/icon-theme: Disconnect from settings signals on disposal

Icon themes can be created by extensions and thus are likely destroyed on extension unload, so we must disconnect from StSettings signals to avoid accessing to invalid memory.

Core was generated by `/usr/bin/gnome-shell'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __pthread_kill_implementation (no_tid=0, signo=11, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
44	./nptl/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7f93b17fe600 (LWP 55580))]
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=11, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=11, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ./nptl/pthread_kill.c:89
#3  0x00007f93b763c406 in __GI_raise (sig=sig@entry=11) at ../sysdeps/posix/raise.c:26
#4  0x00005640ebf8ba9a in dump_gjs_stack_on_signal_handler (signo=11) at ../src/main.c:475
#5  0x00007f93b763c4b0 in <signal handler called> () at /lib/x86_64-linux-gnu/libc.so.6
#6  __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:283
#7  0x00007f93b799be3b in update_current_theme (icon_theme=0x5640f49f5750) at ../src/st/st-icon-theme.c:369
#8  0x00007f93b8587010 in g_closure_invoke () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#9  0x00007f93b85b44c6 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007f93b85a594a in g_signal_emit_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#11 0x00007f93b85a5bd3 in g_signal_emit () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#12 0x00007f93b8591c84 in  () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#13 0x00007f93b8595007 in g_object_notify_by_pspec () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#14 0x00007f93b858592f in g_cclosure_marshal_VOID__STRINGv () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007f93b85a5aec in g_signal_emit_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#16 0x00007f93b85a5bd3 in g_signal_emit () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#17 0x00007f93b811c68a in  () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#18 0x00007f93b80a6c0b in  () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#19 0x00007f93b85a5aec in g_signal_emit_valist () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#20 0x00007f93b85a5bd3 in g_signal_emit () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007f93b811de7c in  () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#22 0x00007f93b811998e in  () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#23 0x00007f93b7f439cf in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007f93b7f9e468 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007f93b7f4306f in g_main_loop_run () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007f93b7abfe59 in meta_context_run_main_loop
    (context=context@entry=0x5640edc9f780, error=error@entry=0x7ffe4abd1158) at ../src/core/meta-context.c:482
#27 0x00005640ebf8af81 in main (argc=<optimized out>, argv=<optimized out>) at ../src/main.c:745
(gdb) f 7
#7  0x00007f93b799be3b in update_current_theme (icon_theme=0x5640f49f5750) at ../src/st/st-icon-theme.c:369
369	../src/st/st-icon-theme.c: No such file or directory.
(gdb) f 7
#7  0x00007f93b799be3b in update_current_theme (icon_theme=0x5640f49f5750) at ../src/st/st-icon-theme.c:369
369	in ../src/st/st-icon-theme.c
(gdb) print icon_theme
$1 = 0x5640f49f5750
(gdb) print *icon_theme
$2 = {parent_instance = {g_type_instance = {g_class = Python Exception <class 'gdb.error'>: No type named TypeNode.
}, ref_count = 19, qdata = 0x676e697200000001}, info_cache = 0x7f93b7f487c0Python Exception <class 'gdb.error'>: There is no member named keys.
, 
  info_cache_lru = 0x5640f0ae4f70 = {0x656363416e6f6349, <error reading variable: Cannot access memory at address 0x6544656c62697373>
(gdb) print icon_theme->current_theme
$3 = 0x31 <error: Cannot access memory at address 0x31>
(gdb) print current_theme
No symbol "current_theme" in current context.
(gdb) print theme
$4 = 0x5640ee1fd5d0 "Yaru"
(gdb) 

See: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/2012021

Merge request reports