[Interest] Never ending thread: blocking GUI
Igor Mironchik
imironchick at gmail.com
Tue Oct 16 17:12:53 CEST 2012
16.10.2012 18:00, Sensei пишет:
> Am I leaking memory? I understand that I'm doing so. How can I delete
> these objects? I mean the thread, searcher, and their parameters, in
> this case. Thanks!
In slot connected to the result signal do:
thread->quit();
thread->wait();
thread->deleteLater();
searcher->deleteLater();
Or you can reuse this objects. Why to create them every time? Do it once
and reuse them.
For thread set his parent to something and Qt will delete him on program
exit or when parent will die.
But searcher can't have any parent outside his thread. So set his parent
to something that will live when thread live.
Or call his deleteLater() slot on program exit.
More information about the Interest
mailing list