[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Suspected KParts problem update
From:       Sven Radej <sven () lisa ! exp ! univie ! ac ! at>
Date:       2000-03-16 11:19:26
[Download RAW message or body]

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.

On the other hand (removed some lines):

QObject::~QObject()
{
    if ( wasDeleted ) {
	qWarning( "Double QObject deletion detected." );
	return;
    }
    wasDeleted = 1;
    emit destroyed();
(...)
    if ( parentObj )			// remove it from parent object
	parentObj->removeChild( this );

So it should still remove itself from parent list. signal "destroyed" is not
used in QObject, but might be in widgets or layouts (in QWidget it is used to
notify focus proxy). Why don´t you try to remove disconnect and see what
happens then?

 -- 
Sven Radej      radej@kde.org
KDE developer   Visit http://www.kde.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic