[Interest] Segmentation fault on exiting Qt event loop

Nikos Chantziaras realnc at gmail.com
Wed Jan 2 00:13:37 CET 2019


Your test application runs fine here. However, that's on Qt 5. I don't 
have Qt 4.

The only thing that comes to mind here is that you are creating a 
QObject (UiAppInstance) before you create your QApplication. If your 
UiAppInstance in your real code is more involved than in this test app, 
then this might be a problem. Try moving the creating of the 
QApplication instance to main(), *before* the creation of the 
UiAppInstance object.


On 01/01/2019 18:48, Ramakanth Kesireddy wrote:
> Hi,
> 
> Please find the sample application attached which throws segmentation 
> fault on click of Quit button in the UI.
> 
> However, in the actual application, if we delete the custom widget and 
> QApplication instance, then it throws segmentation fault on qApp->quit().
> 
> If we destroy any QObject without parent, then there is no seg error on 
> qApp->quit().
> 
> Does this error occurs because of double destroy that we manually 
> destroy objects and later qt also tried to destroy them?
> 
> Please let me know if it is correct to say that widgets(custom widgets 
> with parent) are destroyed by qt but any QObject created without parent 
> needs to be destroyed manually?
> 
> Best Regards,
> Ramakanth
> 
> On Fri, Dec 21, 2018 at 4:24 AM Thiago Macieira 
> <thiago.macieira at intel.com <mailto:thiago.macieira at intel.com>> wrote:
> 
>     On Wednesday, 19 December 2018 16:34:55 -02 Thiago Macieira wrote:
>      >  1) Short: 200 lines or less
>      >  2) Self-contained: single file, no #includes other than Qt's and
>     STL's
>      >  3) Compileable: unless you meant to show a compilation problem
>      >  4) Example: demonstrates your problem.
>      >
>      > http://sscce.org/
> 
>     One more thing:
>     5) is tested with a *supported* Qt version. That's 5.9 or 5.12 today.
> 
>     I understand you're working with 4.8. I don't care.
> 
>     -- 
>     Thiago Macieira - thiago.macieira (AT) intel.com <http://intel.com>
>        Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list