Details
-
Bug
-
Resolution: Invalid
-
P1: Critical
-
None
-
4.6.0
-
None
-
*Windows XP Professional - 32bit*
*Visual Studio 2005 Professional*
*Qt 4.6.0*
Description
I have created a simple application that demonstrates this error/behavior. The application is called qtThreads.exe and the source is listed at the bottom of this post.
In the following examples the application is being run from a Windows console.
Example #1 - Works as expected
qtThreads.exe
- Output:
Non-Threaded
Example #2 - Generates warning
qtThreads.exe wait
- Output:
Threaded QWaitCondition: Destroyed while threads are still waiting
Example #3 - Generates deadlock
qtThreads.exe nowait
- Output:
Threaded
Source Code:
#include <QtCore/QtConcurrentRun> #include <QtCore/QReadWriteLock> #include <iostream> void foo() { QReadWriteLock lock; lock.lockForRead(); lock.unlock(); } int main(int argc, char* argv[]) { if (argc > 1) { std::cerr << "Threaded\n"; QFuture<void> future = QtConcurrent::run(&foo); if (strcmp(argv[1], "wait") == 0) { future.waitForFinished(); } } else { std::cerr << "Non-Threaded\n"; foo(); } return 0; }