[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Suspected KParts problem update
From: David Faure <david () mandrakesoft ! com>
Date: 2000-03-16 11:13:33
[Download RAW message or body]
On Thu, Mar 16, 2000 at 12:19:26PM +0100, Sven Radej wrote:
> On Thu, 16 Mar 2000, Don Sanders wrote:
> >You guys awake yet? The suspected KParts bug (Konqueror and KMail crashing on
> >exit) is still open right?
> >
> >Well it's 'caused' by the "delete (QWidget *)m_widget;" statement in
> >kparts/part.cpp
> >
> >Part::~Part()
> >{
> > if ( m_widget )
> > {
> > // We need to disconnect first, to avoid calling it !
> > disconnect( m_widget, SIGNAL( destroyed() ),
> > this, SLOT( slotWidgetDestroyed() ) );
> > kdDebug(1000) << "deleting widget " << m_widget->name() << endl;
> > delete (QWidget *)m_widget; // <<<< sanders - I'm guilty!! <<<<<<
> > }
> >
> > delete d;
> >}
> >
> >Even without this delete statement m_widget is still deleted. But with it
> >m_widget is attempted to be deleted twice. (Without the delete statement both
> >KMail and Konqueror exit normally that is they don't segfault)
>
> Why do you disconnect destroyed signal? This signal might be used in widgets
> for widget´s death notification.
Please read the full source before commenting an extract !
As the comment says, the disconnect() here is needed to avoid
calling slotWidgetDestroyed, since that one in turn destroys the part
(-> infinite loop).
Note that it only disconnects that self-owned slot. If people use
the destroyed signal it will still work.
The part does the connect itself, it can do the disconnect itself
with no problem.
--
David FAURE
david@mandrakesoft.com, faure@kde.org
http://home.clara.net/faure/
KDE, Making The Future of Computing Available Today
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic