keditbookmarks crash, KParts related

David Faure faure at kde.org
Mon Jun 13 12:49:25 BST 2005


On Friday 10 June 2005 18:02, Koos Vriezen wrote:
> On Fri, Jun 10, 2005 at 05:23:55PM +0200, David Faure wrote:
> > For KDE4 I plan to remove this magic from KParts, it's just too much trouble
> > (like in this case; it's really unexpected that s_part gets deleted on you).
> 
> Yes, but isn't that asking for trouble? I thought the meta idea was that
> the widget and part should be together destroyed. 
Right.

> Given that the widget 
> and part may have different parents, this change could mean that the
> widget still lives and the part is dead or visa versa, no?
Right, this situation should only be very temporary, otherwise things will
crash, of course.

Maybe we can keep the "connection to destroyed signal from the widget" inside 
KParts, but only to set the part's widget to 0 (to avoid crashes or make them clearer),
not to actually delete the part in a suicidal manner like we do now (which itself
requires the app to watch for it with a QGuardedPtr).

> So one needs two quardedptr instead of one?
No, zero-to-two normal "delete" statements instead of any QGuardedPtr.
Zero if you simply wait for the parent objects to be destroyed, one or two
if you like to mirror new with deletes, or to delete something before its
parent gets destroyed. But no automatic deletion means no surprises, and
no need for QGuardedPtr. And if we pair new with deletes, no leaks either.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).





More information about the kfm-devel mailing list