Hi,

I'm building a program with a working thread.

Qt Code:
  1. Worker w1;
  2. Worker *w2 = new Worker;
  3.  
  4.  
  5. w1.moveToThread(t1);
  6. w2->moveToThread(t2);
To copy to clipboard, switch view to plain text mode 

But who is going to delete w1 and w2 after t1 and t2 are stopped?
I think the thread where w1 and w2 is created is better not doing that. But when t1 and t2 are stopped, the working threads don't exist any more, it's not likely to delete them after that. I found that with t1 stopped and having its threadID back to 0, w1's threadID is still the one t1 used to have, which may imply that w1 is not going to any new thread after t1 stopped. Especially for w1, it can only be destroyed by the object inside which it is declared, which lives in the old thread. For w2, I have no idea where and when to call delete w2.

Maybe I have some misunderstanding with this, any help will be appreciated.