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.
This commit is contained in:
Nikos Tsipinakis 2018-05-12 14:27:13 +03:00
parent 1fe80a5db8
commit 5761ef1c09

View File

@ -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);