[Qt-interest] seg faults in QApplication destructor?

Alan Ezust alan.ezust at gmail.com
Thu Jan 8 19:46:54 CET 2009


Hrm... Come to think of it, you are right. When you delete a QObject,
it should be removed from the child list of whatever parent it was in
before... So forget that explanation.

I'm trying to remember how I once had a segfault on exit, and what was
the cause. It was related to out of order destruction of some sort,
and changing the parent of a particular object made the problem go
away...  Because it was not supposed to be destroyed at that time.

If I come up with a good example, I'll post it.

On Wed, Jan 7, 2009 at 5:32 PM, Sonic <syamcr at gmail.com> wrote:
> Alan Ezust wrote:
>> If for example, you added a heap QObject to a pointer collection, but
>> it also has a parent which is indirectly or directly a child of one of
>> your QWidgets, or the QApplication. Then before exit, you iterate
>> through the collection, deleting all the heap objects in it, but they
>> are still in the childlist of another QObject.
>>
> Will that happen? When I delete a QWdiget/QObject using the delete
> operator, isn't it automatically removed from it's parent's list of
> children?
>
>
>> On Wed, Jan 7, 2009 at 3:33 PM, John Dailey <john.w.dailey at gmail.com> wrote:
>>
>>> I am working on a QT4.3.4 project that I inherited and it is behaving
>>> in a manner that seems strange to me.  It consistently seg faults in
>>> the QApplication destructor (according to GDB anyway).  The back trace
>>> generated when it does seg fault is not consistant, but it seems to go
>>> through QHash and free on it's ultimate path to oblivion.  I am a
>>> novice when it comes to QT and to gui programming in general so I fear
>>> I may be missing something obvious.
>>>
> Are you using command line arguments (in main() and passed on to
> QApplication?
>
> Syam
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



More information about the Qt-interest-old mailing list