Are you using threads? Are you possibly modifying the GUI anyhow from an another thread than the main GUI thread?
Are you using threads? Are you possibly modifying the GUI anyhow from an another thread than the main GUI thread?
J-P Nurmi
Yes. However, the interaction between the threads is using the signal-slot mechanism.
The thing I don't understand is why it all works as expected when I click some widgets in the form before closing the application but it throws an exception when I close the application immediately after launch.
Maybe the problem is with cleaning up the thread(s)? The destructor of the QThread subclass is executed in the thread where the QThread object lives in (usually same thread where it was created in), not in the thread being executed in QThread::run().
J-P Nurmi
This does seem to be what the problem is but I am yet to resolve it. When I click inside the form and then close the application, all threads are exiting correctly. However, when I close the applicaton immediately after launch, the application throws the error and the threads aren't exiting correctly.
If I profile the application using DependencyWalker and close the application immediately after launch I get the following:
Second chance exception 0xC0000008 (Invalid Handle) occurred in "c:\windows\system32\NTDLL.DLL" at address 0x7C90EB74 by thread 30.
Thread 2 exited with code -1073741816 (0xC0000008).
Thread 4 exited with code -1073741816 (0xC0000008).
Thread 1 exited with code -1073741816 (0xC0000008).
Thread 3 exited with code -1073741816 (0xC0000008).
Thread 9 exited with code -1073741816 (0xC0000008).
Thread 11 exited with code -1073741816 (0xC0000008).
Thread 16 exited with code -1073741816 (0xC0000008).
Thread 18 exited with code -1073741816 (0xC0000008).
Thread 24 exited with code -1073741816 (0xC0000008).
However, if I click a widget inside the form before closing, the DependencyWalker log is as follows:
Thread 29 exited with code 0 (0x0).
Thread 27 exited with code 0 (0x0).
Thread 3 exited with code 0 (0x0).
Thread 2 exited with code 0 (0x0).
Thread 30 exited with code 0 (0x0).
Thread 9 exited with code 0 (0x0).
Thread 4 exited with code 0 (0x0).
Thread 24 exited with code 0 (0x0).
Thread 11 exited with code 0 (0x0).
Thread 16 exited with code 0 (0x0).
Thread 18 exited with code 0 (0x0).
When do the threads get started? How are they cleaned up? Are they running even loops?
J-P Nurmi
This problem looks to be occurring due to a bug in Qt4.2 that occurs when using threads that are not QThreads. Here is the link to the reported bug in Task Tracker.
http://www.trolltech.com/developer/t...ntry&id=134313
Thanks everyone for your suggestions.
elsbels1 (17th January 2007)
Bookmarks