[Qt-interest] How to stop all threads before quit?
Mandeep Sandhu
mandeepsandhu.chd at gmail.com
Wed Mar 2 06:05:41 CET 2011
> Scanner working in thread. If user close window, thread still running and
> program finishing unexpectedly. So, how can I close all threads before
> exiting program?
You need to quit your thread gracefully by exiting the run() method of
your thread and delete your thread object only after that.
I gave a quick look to your code and seems like you're quitting the
run method correctly...but...you need to "wait()" for the thread
before destroying your thread object. So call QThread::wait() in your
thread object's d'tor and it should work.
HTH,
-mandeep
>
> Best regards,
> Nick.
> --
> За використання революційного клієнта електронної пошти Opera:
> http://www.opera.com/mail/
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
More information about the Qt-interest-old
mailing list