dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.56k stars 340 forks source link

Segfault in XrmDestroyDatabase in dunst 1.9.2 #1258

Closed fwsmit closed 7 months ago

fwsmit commented 8 months ago

Discussed in https://github.com/dunst-project/dunst/discussions/1256

Originally posted by **cdown** April 28, 2023 Didn't debug further yet since I'm going to be away for a bit, but I figure you'd like to know: ``` (gdb) bt #0 ___pthread_mutex_lock (mutex=0x0) at pthread_mutex_lock.c:80 #1 0x00007f292eeb1733 in XrmDestroyDatabase (db=0x7f2918003860) at /usr/src/debug/libx11/libX11-1.8.4/src/Xrm.c:2653 #2 0x00007f292eeab8c6 in XrmSetDatabase (display=0x5560554e43c0, database=0x5560555675c0) at /usr/src/debug/libx11/libX11-1.8.4/src/Xrm.c:354 #3 0x00005560546707b1 in XRM_update_db () at src/x11/x.c:493 #4 0x0000556054670c38 in x_mainloop_fd_dispatch (source=, callback=, user_data=) at src/x11/x.c:354 #5 0x00007f292eac853b in g_main_dispatch (context=0x5560554c90d0) at ../glib/glib/gmain.c:3460 #6 g_main_context_dispatch (context=0x5560554c90d0) at ../glib/glib/gmain.c:4200 #7 0x00007f292eb25219 in g_main_context_iterate.constprop.0 (context=0x5560554c90d0, block=1, dispatch=1, self=) at ../glib/glib/gmain.c:4276 #8 0x00007f292eac7c7f in g_main_loop_run (loop=0x5560554d4820) at ../glib/glib/gmain.c:4479 #9 0x000055605466063d in dunst_main (argv=, argc=) at src/dunst.c:227 #10 main (argc=, argv=) at /usr/src/debug/dunst/dunst-1.9.2/main.c:5 ``` So somehow ___pthread_mutex_lock is getting NULL. This only happens immediately after starting X/wm/etc, so my guess is something is racing.
bynect commented 7 months ago

This is an interesting issue, maybe it has to do with the way the xrm database is first initialized with the static variable? I'll try looking into it

bynect commented 7 months ago

Fixed in #1291