From 11addea193c69833c5aa8e1da72fb9e1b2be2f1d Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Sun, 29 Mar 2020 18:03:50 +0800 Subject: Do not core dump when exiting due to loss of X connection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `g_critical` function will core dump if critical errors are marked fatal (which they are in xss-lock). Instead log as informational and exit. Thanks to Tomáš Janoušek for the bug report and original patch. Closes: --- src/xss-lock.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/xss-lock.c b/src/xss-lock.c index 31e161d..95f049c 100644 --- a/src/xss-lock.c +++ b/src/xss-lock.c @@ -161,10 +161,12 @@ screensaver_event_cb(xcb_connection_t *connection, xcb_generic_event_t *event, const int *const xcb_screensaver_notify) { uint8_t event_type; - - if (!event) - g_critical("X connection lost; exiting."); - + + if (!event) { + g_info("X connection lost; exiting."); + exit(EXIT_FAILURE); + } + event_type = XCB_EVENT_RESPONSE_TYPE(event); if (event_type == 0) { xcb_generic_error_t *error = (xcb_generic_error_t *)event;