[Interest] Segmentation fault on exiting Qt event loop

Konstantin Shegunov kshegunov at gmail.com
Mon Dec 17 12:29:28 CET 2018


On Mon, Dec 17, 2018 at 1:26 PM Andrew Ialacci <andrew at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181217/f7573ab4/attachment.html>


More information about the Interest mailing list