doggrant
7th March 2012, 09:52
Hi,
I've got a very strange issue. Where by when running my application under the debugger I get an access violation when everything is being cleared up.
However, if i run it outside of the debugger, in either release or debug mode, it exits cleanly.
When my app closes, the destructors for various objects are called. In one of my destructors I have this code, which signals to an external thread, to stop, and then waits for that thread to exit - I do this with an event loop, so as not to freeze the GUI
// A ten second timeout, to wait for the hotswap thread to exit
// If it takes longer than this, then we'll just kill it off.
QEventLoop EventLoop;
QTimer WatchdogTimer(this);
WatchdogTimer.setSingleShot(true);
connect(&WatchdogTimer, SIGNAL(timeout()), &EventLoop, SLOT(quit()));
connect(this, SIGNAL(finished()),&EventLoop, SLOT(quit()));
WatchdogTimer.start(10000); // 10s timeout
// Signal hostswap thread quit before entering event loop
osSignalWaitObject(m_Terminate_hot_swap_thread);
EventLoop.exec();
As I said, when the code is run in the debugger, I get an access violation when stepping over 'EventLoop.exec();'
7475
Has anyone come across this issue before?
David
I've got a very strange issue. Where by when running my application under the debugger I get an access violation when everything is being cleared up.
However, if i run it outside of the debugger, in either release or debug mode, it exits cleanly.
When my app closes, the destructors for various objects are called. In one of my destructors I have this code, which signals to an external thread, to stop, and then waits for that thread to exit - I do this with an event loop, so as not to freeze the GUI
// A ten second timeout, to wait for the hotswap thread to exit
// If it takes longer than this, then we'll just kill it off.
QEventLoop EventLoop;
QTimer WatchdogTimer(this);
WatchdogTimer.setSingleShot(true);
connect(&WatchdogTimer, SIGNAL(timeout()), &EventLoop, SLOT(quit()));
connect(this, SIGNAL(finished()),&EventLoop, SLOT(quit()));
WatchdogTimer.start(10000); // 10s timeout
// Signal hostswap thread quit before entering event loop
osSignalWaitObject(m_Terminate_hot_swap_thread);
EventLoop.exec();
As I said, when the code is run in the debugger, I get an access violation when stepping over 'EventLoop.exec();'
7475
Has anyone come across this issue before?
David