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

QThread::quit() does not work on OS X.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P1: Critical
    • None
    • 5.5.0, 5.5.1, 5.6.0 Beta
    • Core: Threads
    • OS X
    • macOS

    Description

      The user wants to use moveToThread method for executing some long-run operations. The user wants to run threads with the High-priority. The user wants to shutdown those threads on application exit. The things user noticed:

      Linux Ubuntu 14.04:

      • QThread::quite(); and then QThread::wake() methods are working as expected (worker thread is shutdown and the application exits without crash)

      OS X 10.10:

      • QThread::quite() - application gets stuck
      • QThread::terminate() - application exits normally (Please see the code attached on how does it was implemented)

      Steps to reproduce:

      • Unpack both applications
      • Run both applications on OS X and Linux Ubuntu
      • Close both applications (one-by-one or simultaneously if you wish)
      • See the difference on how those applications exits

      The developer should use application attached to reproduce the issue.

      The application with QThread::terminate() should throw in output console this message:

      Qt has caught an exception thrown from an event handler. Throwing
      exceptions from an event handler is not supported in Qt. You must
      reimplement QApplication::notify() and catch all exceptions there.
      
      bleKilled
      Qt has caught an exception thrown from an event handler. Throwing
      exceptions from an event handler is not supported in Qt. You must
      reimplement QApplication::notify() and catch all exceptions there.
      
      hidKilled
      QXcbWindow: Unhandled client message: "_COMPIZ_TOOLKIT_ACTION"
      QXcbWindow: Unhandled client message: "_COMPIZ_TOOLKIT_ACTION"
      /home/build-QThread_MTT-Desktop_Qt_5_5_1_GCC_64bit-Debug/QThread_Subclass exited with code 0
      

      UPDATE 1:
      QThread::terminate() can make the application get stuck on the second thread wait() method call (OS X 10.10)

      UPDATE 2:
      The attached application with postfix "_hack" will work well on both platforms...

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-49539
          # Subject Branch Project Status CR V

          Activity

            People

              sorvig Morten Sørvig
              dmnikola Dmitry Nikolaev
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes