Quote Originally Posted by yxtx1984 View Post
Yes, it will go to QThreadData::deref(), but the problem is that the _ref.deref is not equal to 0 when the application is going to exit.
The object will call destructor by itself when the application exit.
I will try to use a singleton.
Thanks!
I don't get it. If _ref.deref != 0 QThreadData::deref should call "delete this", which seems to be what you want?

Which tool are you using to check for memory leaks? Do you compile without optimization? Compile with (aggressive) optimization may give false results.

If you still have problems, maybe you could supply a small program which exactly demonstrates the problem.