Bug 72502

Summary: Kdevelop crashes when closing multiple files via Keyboard shortcut (Ctrl + W)
Product: [Applications] kdevelop Reporter: Dan Christensen <daniel_l_christensen>
Component: bookmarks partAssignee: KDevelop Developers <kdevelop-devel>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: 3.0.0b2   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: suggested patch

Description Dan Christensen 2004-01-12 19:46:06 UTC
Version:           3.0.0.b2 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.3.1 
OS:          Linux

Steps to duplicate:
1. Open up multiple files in KDevelop (10 - 20)
2. Attempt to close all files by clicking Ctrl+W repeatedly
3. KDevelop crashes (not necessarily on any particular file)
I can duplicate this every time that I try. However, you can workaround the problem by pausing for a couple of seconds between each keystroke.
Comment 1 Amilcar do Carmo Lucas 2004-01-12 19:57:26 UTC
Can you reproduce it in KATE?
If you can it is a KATE bug.
Comment 2 Dan Christensen 2004-01-12 20:11:22 UTC
I cannot duplicate it in Kate.
Comment 3 Dan Christensen 2004-01-12 20:17:18 UTC
Here is the backtrace that I get:
[New Thread 16384 (LWP 31945)]
[New Thread 32769 (LWP 31957)]
[New Thread 49154 (LWP 2021)]
0x41a60ab6 in waitpid () from /lib/i686/libpthread.so.0
#0  0x41a60ab6 in waitpid () from /lib/i686/libpthread.so.0
#1  0x40efeba2 in KCrash::defaultCrashHandler(int) (sig=11) at kcrash.cpp:246
#2  0x41a5f96c in __pthread_sighandler () from /lib/i686/libpthread.so.0
#3  <signal handler called>
#4  0x41b5f7ed in __dynamic_cast () from /usr/lib/libstdc++.so.5
#5  0x4265cd54 in BookmarksPart::marksChanged() ()
   from /opt/kde3/lib/kde3/libkdevbookmarks.so
#6  0x4265e83f in BookmarksPart::qt_invoke(int, QUObject*) ()
   from /opt/kde3/lib/kde3/libkdevbookmarks.so
#7  0x4133aeab in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#8  0x4133ac74 in QObject::activate_signal(int) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#9  0x4166c619 in QTimer::timeout() () from /usr/lib/qt3/lib/libqt-mt.so.3
#10 0x4135d233 in QTimer::event(QEvent*) () from /usr/lib/qt3/lib/libqt-mt.so.3
#11 0x412d9906 in QApplication::internalNotify(QObject*, QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#12 0x412d8c2e in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#13 0x40e90503 in KApplication::notify(QObject*, QEvent*) (this=0xbfffeeb0, 
    receiver=0x9d5bc70, event=0xbfffec50) at kapplication.cpp:511
#14 0x412c5df3 in QEventLoop::activateTimers() ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#15 0x412805ad in QEventLoop::processEvents(unsigned) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#16 0x412edc50 in QEventLoop::enterLoop() ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#17 0x412edb46 in QEventLoop::exec() () from /usr/lib/qt3/lib/libqt-mt.so.3
#18 0x412d9b9f in QApplication::exec() () from /usr/lib/qt3/lib/libqt-mt.so.3
#19 0x080646ec in main ()
Comment 4 Jens Dagerbo 2004-01-12 20:36:25 UTC
Please, what KDE version are you running?
Comment 5 Jens Dagerbo 2004-01-12 20:52:26 UTC
I think I know what's going on, but I can't make it crash here.
Comment 6 Jens Dagerbo 2004-01-12 21:18:17 UTC
Created attachment 4128 [details]
suggested patch

Please test with the attached patch.
Comment 7 Dan Christensen 2004-01-12 21:56:09 UTC
I am running 3.1.94 KDE installed from Suse RPM's. My kdevelop is compiled from CVS source... I believe that I last updated on January 9th. I will apply your patch, recompile and let you know if it worked.
Comment 8 Dan Christensen 2004-01-12 23:04:05 UTC
The patch seems to have fixed the problem for me. Thanks!
Comment 9 Alexander Dymo 2004-01-15 22:15:52 UTC
Subject: kdevelop

CVS commit by dymo: 

Commited patches to fix 
#72582 Crashes while loading plugins after unloading plugins
#72502 Kdevelop crashes when closing multiple files via Keyboard 

CCMAIL: 72582-done@bugs.kde.org
CCMAIL: 72502-done@bugs.kde.org


  M +2 -0      lib/interfaces/kdevapi.cpp   1.11
  M +15 -24    parts/bookmarks/bookmarks_part.cpp   1.18


--- kdevelop/parts/bookmarks/bookmarks_part.cpp  #1.17:1.18
@@ -151,7 +151,7 @@ void BookmarksPart::marksChanged()
         {
                 KParts::ReadOnlyPart * ro_part = *it;
-                KTextEditor::MarkInterface * mi = dynamic_cast<KTextEditor::MarkInterface*>( ro_part );
-        
-                if ( ro_part && mi && partIsSane( ro_part ) )
+                if ( partIsSane( ro_part ) )
+                {
+                        if ( dynamic_cast<KTextEditor::MarkInterface*>( ro_part ) )
                 {
                         if ( EditorData * data = storeBookmarksForURL( ro_part ) )
@@ -165,4 +165,5 @@ void BookmarksPart::marksChanged()
                         }
                 }
+                }
                 ++it;
         }
@@ -505,17 +506,7 @@ KParts::ReadOnlyPart * BookmarksPart::pa
 bool BookmarksPart::partIsSane( KParts::ReadOnlyPart * ro_part )
 {
-        //kdDebug(0) << "BookmarksPart::partIsSane()" << endl;
-        
-        bool isSane = true;
-        
-        isSane = isSane && partController()->parts()->contains( ro_part);
-        isSane = isSane && !ro_part->url().path().isEmpty();
-        
-        if ( ! isSane )
-        {
-                //kdDebug(0) << " ** Non-sane part encountered! ** " << endl;
-        }
-        
-        return isSane;
+        return ( ro_part != 0 ) && 
+                        partController()->parts()->contains( ro_part) &&
+                        !ro_part->url().path().isEmpty();
 }
 

--- kdevelop/lib/interfaces/kdevapi.cpp  #1.10:1.11
@@ -157,4 +157,6 @@ void KDevApi::registerVersionControl( KD
 void KDevApi::unregisterVersionControl( KDevVersionControl *vcs )
 {
+    if( vcs == d->m_versionControl )
+        setVersionControl( 0 );
     d->m_registeredVcs.remove( vcs->uid() );
 }