Quote Originally Posted by mclark View Post
What\Who is deleting the QTimer?
Provided that the timer doesn't have a parent it has to be you or the timer is not deleted at all.
Why is the m_pTimer value valid immediately after exec() returns but invalid when isActive() is called?
Maybe you have a local variable somewhere that is named the same and it shadows the other variable?

Would it be better to handle the deletion of m_pTimer in response to the QThread::finished() signal?
No. If you create an object in run(), destroy it there. The timer won't timeout anyway after you return from exec() so there is no point in keeping it. I even suggest you change your run() a bit:

Qt Code:
  1. void ...:run(){
  2. QTimer timer;
  3. connect(&timer, SIGNAL(timeout()), this, SLOT(checkTimestamp()));
  4. timer.start(5000);
  5. exec();
  6. // the timer will get deleted when run() returns
  7. }
To copy to clipboard, switch view to plain text mode 

By the way, I hope you realize the slot will be called in the context of the main thread and not the worker thread. What is the point in doing all that in a worker thread anyway? Does the thread do anything else besides running the timer?