-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.0
-
None
-
Windows XP SP3
Qt 4.7
Visual Studio 2008 Version 9.0.30729.1 SP
-
b93947f5a25b3cc021518b944dc96b892f672bd3
If I call QThread::quit() or QThread::exit() (which is pretty much same) before actual running of an instance of QThread it will spoil the message loop forcing it to exit immediately. It seems wrong because exit() as a regular member function must not affect the thread in the not running state and quit() as a regular slot must not keep/remember an incoming signal if there's no message loop in the current object.
It's easy to reproduce:
MyThread thread; thread.exit(555); // or quit() thread.start(); ... MyThread::run() { QThread::exec(); // exits immediately with exit code 555 or 0 in case of quit() }
Full example is attached.
- relates to
-
QTBUG-15378 QThread::exec always returns immediately, if QThread::exit has been called when event loop was not running.
-
- Closed
-