[Interest] Segmentation fault on exiting Qt event loop

Ramakanth Kesireddy rama.kesi at gmail.com
Wed Dec 19 10:51:24 CET 2018


Yes QApplication destructor is invoked last..Does it makes sense to use
deleteLater() in the widget destructors instead of existing delete if it
could be cleaned up as part of qApp-quit()?

On Wed, 19 Dec, 2018, 12:03 Konstantin Shegunov <kshegunov at gmail.com wrote:

> On Tue, Dec 18, 2018 at 8:25 AM Ramakanth Kesireddy <rama.kesi at gmail.com>
> wrote:
>
>> Thanks for your mail..Yes did try with valgrind but couldn't detect
>> memory issue may be due to the way our app is designed using threading.
>> But wondering why it throws segmentation fault if qApp instance is
>> created on stack but not on Heap as I understand that it is mandatory to
>> construct qApp instance on stack by design.
>>
>
> QObject (and QCoreApplication) doesn't impose such a limitation, no, you
> can have them in the heap or stack. I'd be really surprised, though, if you
> don't get the same segfault at the point of the delete call. If you mean
> that you just don't free it up, however, then that's a major code smell.
> From your description I'd hazard a guess that you have a QObject which
> outlives the application (probably a global). This is not allowed, and as
> Thiago already said you must clean up before the Q*Application's
> destructor's run.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181219/4e6b87ec/attachment.html>


More information about the Interest mailing list