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

Qt Code:
  1. // A ten second timeout, to wait for the hotswap thread to exit
  2. // If it takes longer than this, then we'll just kill it off.
  3. QEventLoop EventLoop;
  4. QTimer WatchdogTimer(this);
  5. WatchdogTimer.setSingleShot(true);
  6. connect(&WatchdogTimer, SIGNAL(timeout()), &EventLoop, SLOT(quit()));
  7. connect(this, SIGNAL(finished()),&EventLoop, SLOT(quit()));
  8. WatchdogTimer.start(10000); // 10s timeout
  9.  
  10. // Signal hostswap thread quit before entering event loop
  11. osSignalWaitObject(m_Terminate_hot_swap_thread);
  12.  
  13. EventLoop.exec();
To copy to clipboard, switch view to plain text mode 

As I said, when the code is run in the debugger, I get an access violation when stepping over 'EventLoop.exec();'

untitled.JPG

Has anyone come across this issue before?

David