diff --git a/src/common.h b/src/common.h index f2ddd19a..87d14082 100644 --- a/src/common.h +++ b/src/common.h @@ -153,6 +153,8 @@ typedef struct session { // === Display related === /// Display in use. Display *dpy; + /// Previous handler of X errors + XErrorHandler previous_xerror_handler; /// Default screen. int scr; /// XCB connection. diff --git a/src/compton.c b/src/compton.c index e9dff9ab..38504a57 100644 --- a/src/compton.c +++ b/src/compton.c @@ -1601,7 +1601,7 @@ static session_t *session_init(int argc, char **argv, Display *dpy, const xcb_query_extension_reply_t *ext_info; - XSetErrorHandler(xerror); + ps->previous_xerror_handler = XSetErrorHandler(xerror); ps->scr = DefaultScreen(ps->dpy); @@ -2183,6 +2183,8 @@ static void session_destroy(session_t *ps) { xrc_report_xid(); #endif + XSetErrorHandler(ps->previous_xerror_handler); + // Stop libev event handlers ev_timer_stop(ps->loop, &ps->unredir_timer); ev_timer_stop(ps->loop, &ps->fade_timer);