Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
6.3.2
-
None
-
Arch Linux
-
-
Foundation PM Staging
Description
Starting a QtConcurrent::task in a custom threadpool like depicted in the docks, results in a QFuture whose task may in fact be executed in a thread that's not part of the pool. This is really unexpected behavior.
Apparently the reason lies in calling stealAndRunRunnable in qfutureinterface.cpp around line 400. The task is then executed in the thread that has the QFuture, and any thread specific assertions will fail.
I noticed the issue when I started randomly getting errors like this one from Qt's SQL driver:
QSqlDatabasePrivate::database: requested database does not belong to the calling thread.
Here's a related issue from StackOverflow: https://stackoverflow.com/questions/28332199/how-does-qtconcurrentrun-wind-up-on-main-thread
Attachments
Issue Links
- is duplicated by
-
QTBUG-112345 QtConcurrent::run() not always execute task in another thread
-
- Closed
-