Bug 47877

Summary: PartManager does not inform its parts that it is going to be destroyed
Product: [Frameworks and Libraries] kdelibs Reporter: Heinz Hornung <Hornung-Heinz>
Component: generalAssignee: Simon Hausmann <hausmann>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Heinz Hornung 2002-09-15 10:11:57 UTC
Version:           gideon HEAD from approximately 13/09/2002 (using KDE KDE 3.0.7)
Installed from:    Compiled From Sources
OS:          Linux

I came accross a bug which causes gideon to crash on leaving. 
The bug is located in the PartManager of kdelib-3.0.7. The PartManager does not inform its parts if it is about to be destroyed. Therefore, a part tries to access its PartManager, even if it is gone. The following patch takes care of this bug:

*** ../../temp/kdelibs-3.0.7/kparts/partmanager.cpp	Mon Aug  5 17:39:45 2002
--- kparts/partmanager.cpp	Sun Sep 15 09:47:08 2002
***************
*** 103,108 ****
--- 103,116 ----

    // core dumps ... setActivePart( 0L );
    qApp->removeEventFilter( this );
+
+   // Inform all parts that their manager is gone.
+   QPtrListIterator<Part> itpart ( d->m_parts );
+   for ( ; itpart.current() ; ++itpart )
+   {
+       itpart.current()->setManager(0);
+   }
+
    delete d;
  }
Comment 1 Heinz Hornung 2002-09-15 10:18:51 UTC
I've already sent this information to the kdevelop-team and wanted to inform 
the KDE-Team as well. Didn't mean to send the same report twice to the 
kdevelop-team...  
Comment 2 Simon Hausmann 2002-09-15 11:25:35 UTC
Quite an uncommon case that the partmanager is destroyed before the parts, which
is probably why noone noticed this bug before :) . In any case thanks a lot for
the report/patch, it's fixed now in HEAD.