From 5761ef1c0952fb46eb3017e23162fb6bf25d7ea2 Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Sat, 12 May 2018 14:27:13 +0300 Subject: [PATCH] Fix segfault with startup_notification As it currently stands notification_init uses xctx.color to initialize the notification colors which means that it depends on x11 having been previously initialized and crashes otherwise. This bug was introduced in 04b327f where draw_setup() was after the startup notification was created. As a temporary fix the notification creation was moved under draw_setup but for a long term solution we should look into removing these xctx dependencies. --- src/dunst.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/dunst.c b/src/dunst.c index 5b8d155..081e2f3 100644 --- a/src/dunst.c +++ b/src/dunst.c @@ -147,6 +147,18 @@ int dunst_main(int argc, char *argv[]) int owner_id = initdbus(); + mainloop = g_main_loop_new(NULL, FALSE); + + draw_setup(); + + guint pause_src = g_unix_signal_add(SIGUSR1, pause_signal, NULL); + guint unpause_src = g_unix_signal_add(SIGUSR2, unpause_signal, NULL); + + /* register SIGINT/SIGTERM handler for + * graceful termination */ + guint term_src = g_unix_signal_add(SIGTERM, quit_signal, NULL); + guint int_src = g_unix_signal_add(SIGINT, quit_signal, NULL); + if (settings.startup_notification) { notification *n = notification_create(); n->id = 0; @@ -162,18 +174,6 @@ int dunst_main(int argc, char *argv[]) // we do not call wakeup now, wake_up does not work here yet } - mainloop = g_main_loop_new(NULL, FALSE); - - draw_setup(); - - guint pause_src = g_unix_signal_add(SIGUSR1, pause_signal, NULL); - guint unpause_src = g_unix_signal_add(SIGUSR2, unpause_signal, NULL); - - /* register SIGINT/SIGTERM handler for - * graceful termination */ - guint term_src = g_unix_signal_add(SIGTERM, quit_signal, NULL); - guint int_src = g_unix_signal_add(SIGINT, quit_signal, NULL); - run(NULL); g_main_loop_run(mainloop); g_main_loop_unref(mainloop);