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 <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-08-09 23:34:37 +01:00
parent c719804fb1
commit fae30d46e7
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 12 additions and 12 deletions

View File

@ -1969,18 +1969,6 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
ev_set_priority(&ps->event_check, EV_MINPRI); ev_set_priority(&ps->event_check, EV_MINPRI);
ev_prepare_start(ps->loop, &ps->event_check); 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 // Initialize DBus. We need to do this early, because add_win might call dbus
// functions // functions
if (ps->o.dbus) { if (ps->o.dbus) {
@ -1995,6 +1983,18 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
#endif #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; xcb_window_t *children;
int nchildren; int nchildren;