Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.6.2, 5.7.1
-
None
Description
QXcbConnection::processXcbEvents() starts with:
int connection_error = xcb_connection_has_error(xcb_connection()); if (connection_error) { qWarning("The X11 connection broke (error %d). Did the X11 server die?", connection_error); exit(1); }
calling exit() in a C++ program with threads will lead to havoc as std::exit() will call atexit handlers and eventually also destroy global statics, but it wont unwind the stack. Since thread lifetimes are typically rooted in some automatic variables on the stack, this means we will very often see threads running while global statics are being torn down and this will lead to unnecessary crashes that have to be analyzed and understood, where the only thing that really went wrong is that the X11 server disappeared.
The best solution is for QXcbConnection to call std::quick_exit() after logging the error to terminate as cleanly as it possibly can.