From 80d77b4ee8f79cc984fc6311e233a9de7397e5e1 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Thu, 25 Jul 2019 21:15:47 +0100 Subject: [PATCH] core: don't reuse X connection across resets In theory, it should be fine. But it causes mesa to stuck in xcb_wait_for_special_event, indicating X connection setup issues. Instead of investigating what went wrong in mesa, I choose to apply this simple fix. Signed-off-by: Yuxuan Shui --- src/compton.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compton.c b/src/compton.c index 0370578..7b36e10 100644 --- a/src/compton.c +++ b/src/compton.c @@ -2253,14 +2253,14 @@ int main(int argc, char **argv) { // Main loop bool quit = false; - Display *dpy = XOpenDisplay(NULL); - if (!dpy) { - fprintf(stderr, "Can't open display."); - return 1; - } - XSetEventQueueOwner(dpy, XCBOwnsEventQueue); do { + Display *dpy = XOpenDisplay(NULL); + if (!dpy) { + fprintf(stderr, "Can't open display."); + return 1; + } + XSetEventQueueOwner(dpy, XCBOwnsEventQueue); ps_g = session_init(argc, argv, dpy, config_file, all_xerrors, need_fork); if (!ps_g) { log_fatal("Failed to create new compton session."); @@ -2289,11 +2289,11 @@ int main(int argc, char **argv) { session_destroy(ps_g); free(ps_g); ps_g = NULL; + if (dpy) { + XCloseDisplay(dpy); + } } while (!quit); - if (dpy) { - XCloseDisplay(dpy); - } free(config_file); log_deinit_tls();