Wow, Yes!

I forgot to include actually killing the threads first before checking if they 
are running. Oops…

Assuming each threads quit() is called and all operations are stopped in each 
thread correctly is using a loop and sleep still ok?



From: Konstantin Shegunov <kshegu...@gmail.com>
Date: Monday, December 17, 2018 at 12:30 PM
To: Andrew Ialacci <and...@dkai.dk>
Cc: Ramakanth Kesireddy <rama.k...@gmail.com>, Qt Interest 
<interest@qt-project.org>
Subject: Re: [Interest] Segmentation fault on exiting Qt event loop

On Mon, Dec 17, 2018 at 1:26 PM Andrew Ialacci 
<and...@dkai.dk<mailto:and...@dkai.dk>> wrote:
I’ve had this issue on Windows especially when destroying worker threads on an 
application exit.

Which you shouldn't do.

What I ended up doing was sleeping the main thread until each worker threads 
isRunning() return false;
I’d love to know if this is the //best// solution to this problem but from what 
I’ve found it works very well.

Nope. Call QThread::quit or QThread::requestInterruption (depending on whether 
you have a running event loop in the thread(s)). And wait for them with 
QThread::wait before allowing the QThread objects to be destroyed.
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to