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

QtConcurrent::run crashes on program exit

    XMLWordPrintable

Details

    • Linux/X11, Windows
    • 87b93c29be (qt/qtbase/dev) d915bb8b5f (qt/qtbase/6.2) d915bb8b5f (qt/tqtc-qtbase/6.2) 87b93c29be (qt/tqtc-qtbase/dev) a00578d9aa (qt/tqtc-qtbase/5.15) 73318513b6 (qt/qtbase/6.3) 73318513b6 (qt/tqtc-qtbase/6.3)

    Description

      When an application is about to be closed and all the destructors are called, if there is QtConcurrent::run on the way, it crashes as the internal threadpool pointer is nullptr.

      To reproduce:
      1) Start the application.
      2) Close the application
      -> The program has unexpectedly finished.

      The crash happens in mainwindow.cpp -> QtConcurrent::run.

      Form the code it is not always clear what is the reason for running a thread, so such crashes can only be avoided by this check:

          QThreadPool* threadPool = QThreadPool::globalInstance();
          if(threadPool)
              QtConcurrent::run(..);
      

      Attachments

        Activity

          People

            sonakur Sona Kurazyan
            alexey89 alexey89
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: