Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-59341

QXcbConnection::processXcbEvents() should not call exit()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.6.2, 5.7.1
    • QPA: X11/XCB
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            paeglis Gatis Paeglis
            ts Thomas Sondergaard
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes