[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: keditbookmarks crash, KParts related
From: David Faure <faure () kde ! org>
Date: 2005-06-13 11:56:20
Message-ID: 200506131356.21394.faure () kde ! org
[Download RAW message or body]
On Saturday 11 June 2005 16:26, Daniel Teske wrote:
> Hi,
>
> I'm sorry if my last mail wasn't as clear as I would have liked, let's
> try again.
>
> keditbookmarks has the following code (and that is all the code using
> s_part):
>
> void ActionsImpl::slotPrint() {
> s_part = KParts::ComponentFactory
> ::createPartInstanceFromQuery<KParts::ReadOnlyPart>(
> "text/html", QString::null);
I guess that there is no parent widget because the html-widget becomes a standalone window,
and no parent object because, well, ActionsImpl should handle the deletion anyway...
> // delete s_part; -- dies horribly atm
I have yet to see why - backtrace?
> // TODO - is this a leak?
Yes it is ;)
> And currently it is crashing on exit if the users has openend the print
> dialog. If I uncomment the "delete s_part" it stops crashing.
OK, that's a good reason to make ActionsImpl the parent of the part, so that
when exiting, it gets destroyed at the right time.
Try adding 0,0,this,0 to the arguments to createPartInstanceFromQuery().
> > so if you close the window, the widget tree gets deleted,
> Except that s_part has no parent Widget.
> So I need to delete the part, right?
Not necessarily; having a parent object is enough for it to be destroyed.
Then the widget gets destroyed by KParts.
[Hmm. That's the behavior I want to remove in kde4, but this is a special case
where it's useful since there's no parent widget :-))
Maybe I'll do it halfway: the part dtor deletes the widget, but if the widget
is destroyed we can still expect that something else will destroy the part].
> You are right (as always).
Hehe. I remember one day long ago when I told Waldo "you are always right",
and he answered that he didn't like me saying that :-) He, and I, can be wrong
too, sometimes :)
--
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic