- 
    Bug 
- 
    Resolution: Done
- 
    P2: Important 
- 
    5.15.2, 6.1.2, 6.2.0
- 
    None
- 
        
- 
        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)
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(..);
| For Gerrit Dashboard: QTBUG-98901 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V | 
| 386980,14 | QtConcurrent::run crashes on program exit | dev | qt/qtbase | Status: MERGED | +2 | 0 | 
| 387324,2 | QtConcurrent::run crashes on program exit | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 | 
| 387325,2 | QtConcurrent::run crashes on program exit | 6.3 | qt/qtbase | Status: MERGED | +2 | 0 | 
| 387361,6 | QtConcurrent::run crashes on program exit | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |