From fae30d46e7466ce26ee5b00a0e14816305729d13 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Fri, 9 Aug 2019 23:34:37 +0100 Subject: [PATCH] core: don't initialize dbus in critical section grabbing X server stops the dbus daemon in some cases, causing compton to hang in dbus initialization. Signed-off-by: Yuxuan Shui --- src/compton.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/compton.c b/src/compton.c index 92797a9f..3ed6c9a3 100644 --- a/src/compton.c +++ b/src/compton.c @@ -1969,18 +1969,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy, ev_set_priority(&ps->event_check, EV_MINPRI); ev_prepare_start(ps->loop, &ps->event_check); - e = xcb_request_check(ps->c, xcb_grab_server_checked(ps->c)); - if (e) { - log_fatal("Failed to grab X server"); - goto err; - } - - // We are going to pull latest information from X server now, events sent by X - // earlier is irrelavant at this point. - // A better solution is probably grabbing the server from the very start. But I - // think there still could be race condition that mandates discarding the events. - x_discard_events(ps->c); - // Initialize DBus. We need to do this early, because add_win might call dbus // functions if (ps->o.dbus) { @@ -1995,6 +1983,18 @@ static session_t *session_init(int argc, char **argv, Display *dpy, #endif } + e = xcb_request_check(ps->c, xcb_grab_server_checked(ps->c)); + if (e) { + log_fatal("Failed to grab X server"); + goto err; + } + + // We are going to pull latest information from X server now, events sent by X + // earlier is irrelavant at this point. + // A better solution is probably grabbing the server from the very start. But I + // think there still could be race condition that mandates discarding the events. + x_discard_events(ps->c); + { xcb_window_t *children; int nchildren;