[Interest] Segmentation fault on exiting Qt event loop

Andrew Ialacci andrew at dkai.dk
Mon Dec 17 12:03:24 CET 2018


I’ve had this issue on Windows especially when destroying worker threads on an application exit.

What I ended up doing was sleeping the main thread until each worker threads isRunning() return false;

Something like:

http://share.dkai.dk/Screen-Shot-2018-12-17-12-01-50-n9RsDe43KW.png

I’d love to know if this is the //best// solution to this problem but from what I’ve found it works very well.


From: Interest <interest-bounces at qt-project.org> on behalf of Ramakanth Kesireddy <rama.kesi at gmail.com>
Date: Monday, December 17, 2018 at 11:57 AM
To: Qt Interest <interest at qt-project.org>
Subject: [Interest] Segmentation fault on exiting Qt event loop

Hi,

I'm using Qt 4.8 on TI Sitara embedded linux.

Firstly, a segmentation fault occurs in the destructors, which are called after the event loop is exited. Trying to find the root cause for this.

However, if we comment out the mainwidget destructor call, the QApplication instance created on stack throws a segmentation fault.

But if QApplication is created on heap and qApp->quit() loop and destructor is not called, the seg fault does not occur.

Why does the QApplication instance throw seg fault when created on stack? Is this related to destructor clean up issue?

Should the cleanup of resources be done before
qApp->quit() is called using aboutToQuit() signal?

Best Regards,
Ramakanth

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181217/939b2642/attachment.html>


More information about the Interest mailing list