core: deregister xerror handler in session_destroy
xerror handler might be called during XCloseDisplay, at which point session_t is already destroyed, causing a segfault. Ping #209 Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
d7415fcf2e
commit
6cb5f9711e
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue