Bug 81579 - Crash using shortcut for Add Method...
Summary: Crash using shortcut for Add Method...
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-14 16:04 UTC by Steven T. Hatton
Modified: 2004-05-19 18:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven T. Hatton 2004-05-14 16:04:08 UTC
Version:           3.0.90-CVS (using KDE 3.2.2, SuSE)
Compiler:          gcc version 3.3.1 (SuSE Linux)
OS:                Linux (i686) release 2.4.21-215-default

I set the shotcut for Class browser -> Add Method... to Alt+M.  When I hit Alt+M while the editor had focus, KDevelop crashed. I was able to reproduce that crash 3 times.

I then tried to use the shortcut with the focus in the Class browser.  That opened the Add Method dialog, but crashed when i submitted the dialog.  I was not able to reproduce that crash.

Adding a member function works if I open the Add Method dialog with a mouse click. 

Here is a backtrace of the crash with the focus in the editor:

Using host libthread_db library "/lib/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 21318)]
[New Thread 32769 (LWP 21323)]
[New Thread 16386 (LWP 21324)]
0x419cc006 in waitpid () from /lib/libpthread.so.0
#0  0x419cc006 in waitpid () from /lib/libpthread.so.0
#1  0x40ebf263 in KCrash::defaultCrashHandler ()
   from /opt/kde3/lib/libkdecore.so.4
#2  0x419cabb1 in __pthread_sighandler () from /lib/libpthread.so.0
#3  <signal handler called>
#4  0x080d5d84 in KSharedPtr (this=0xbfffa2c0, p=@0x30) at ksharedptr.h:116
#5  0x4260c35e in ClassDomBrowserItem::dom (this=0x0) at classviewwidget.h:219
#6  0x42603b87 in ClassViewWidget::slotAddMethod (this=0x8822fd0)
    at /download/org/kdevelop/repository/kdevelop/parts/classview/classviewwidget.cpp:898
#7  0x4260596b in ClassViewWidget::qt_invoke (this=0x8822fd0, _id=106, 
    _o=0xbfffa370) at classviewwidget.moc:127
#8  0x4130430b in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#9  0x413040d4 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#10 0x40bd91b9 in KAction::activated () from /opt/kde3/lib/libkdeui.so.4
#11 0x40bd8c2d in KAction::slotActivated () from /opt/kde3/lib/libkdeui.so.4
#12 0x40bd9271 in KAction::qt_invoke () from /opt/kde3/lib/libkdeui.so.4
#13 0x4130430b in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#14 0x413040d4 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#15 0x40eb97d9 in KAccelPrivate::menuItemActivated ()
   from /opt/kde3/lib/libkdecore.so.4
#16 0x40eb7fe5 in KAccelPrivate::eventFilter ()
   from /opt/kde3/lib/libkdecore.so.4
#17 0x41301aae in QObject::activate_filters ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#18 0x413019a0 in QObject::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#19 0x4133b60f in QWidget::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#20 0x413f85f2 in QMainWindow::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#21 0x0810648e in KMdiMainFrm::event (this=0x82a27c0, e=0xbfffaa20)
    at /download/org/kdevelop/repository/kdevelop/lib/qextmdi/kmdimainfrm.cpp:1089
#22 0x412a2b76 in QApplication::internalNotify ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#23 0x412a23d7 in QApplication::notify () from /usr/lib/qt3/lib/libqt-mt.so.3
#24 0x40e3e824 in KApplication::notify () from /opt/kde3/lib/libkdecore.so.4
#25 0x40eb7067 in KAccelEventHandler::x11Event ()
   from /opt/kde3/lib/libkdecore.so.4
#26 0x40e44542 in KApplication::x11EventFilter ()
   from /opt/kde3/lib/libkdecore.so.4
#27 0x41224aa8 in qt_x11EventFilter () from /usr/lib/qt3/lib/libqt-mt.so.3
#28 0x4122ed7c in QApplication::x11ProcessEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#29 0x41247b1d in QEventLoop::processEvents ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#30 0x412b5640 in QEventLoop::enterLoop () from /usr/lib/qt3/lib/libqt-mt.so.3
#31 0x412b5536 in QEventLoop::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#32 0x412a2e0f in QApplication::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#33 0x08099e66 in main (argc=1, argv=0xbfffb0b4)
    at /download/org/kdevelop/repository/kdevelop/src/main.cpp:127


Now a backtrace with the focus in the Class browser:

Using host libthread_db library "/lib/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 20511)]
[New Thread 32769 (LWP 20515)]
[New Thread 16386 (LWP 20516)]
0x419cc006 in waitpid () from /lib/libpthread.so.0
#0  0x419cc006 in waitpid () from /lib/libpthread.so.0
#1  0x40ebf263 in KCrash::defaultCrashHandler ()
   from /opt/kde3/lib/libkdecore.so.4
#2  0x419cabb1 in __pthread_sighandler () from /lib/libpthread.so.0
#3  <signal handler called>
#4  0x080e1c11 in QMapPrivate (this=0x8c3c200, _map=0x8168e20) at qmap.h:441
#5  0x080df0d7 in QMap<QString, QValueList<KSharedPtr<FunctionModel> > >::detachInternal (this=0x8b6e3a4) at qmap.h:840
#6  0x080dafdf in QMap<QString, QValueList<KSharedPtr<FunctionModel> > >::detach (this=0x8b6e3a4) at qmap.h:739
#7  0x080d6f5b in QMap<QString, QValueList<KSharedPtr<FunctionModel> > >::begin
    (this=0x8b6e3a4) at qmap.h:660
#8  0x080d240a in ClassModel::functionList (this=0x8b6e370)
    at /download/org/kdevelop/repository/kdevelop/lib/interfaces/codemodel.cpp:437
#9  0x422d700c in AddMethodDialog::accept (this=0xbfffa180)
    at /download/org/kdevelop/repository/kdevelop/languages/cpp/addmethoddialog.cpp:157
#10 0x4166dc2b in QDialog::qt_invoke () from /usr/lib/qt3/lib/libqt-mt.so.3
#11 0x422f579e in AddMethodDialogBase::qt_invoke (this=0xbfffa180, _id=47, 
    _o=0xbfff9730) at addmethoddialogbase.moc:108
#12 0x422d91a3 in AddMethodDialog::qt_invoke (this=0xbfffa180, _id=47, 
    _o=0xbfff9730) at addmethoddialog.moc:77
#13 0x4130430b in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#14 0x413040d4 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#15 0x4164cdcc in QButton::clicked () from /usr/lib/qt3/lib/libqt-mt.so.3
#16 0x41395cfe in QButton::mouseReleaseEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#17 0x4133bb31 in QWidget::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#18 0x412a2b76 in QApplication::internalNotify ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#19 0x412a26d8 in QApplication::notify () from /usr/lib/qt3/lib/libqt-mt.so.3
#20 0x40e3e824 in KApplication::notify () from /opt/kde3/lib/libkdecore.so.4
#21 0x412314ed in QETWidget::translateMouseEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#22 0x4122f6f5 in QApplication::x11ProcessEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#23 0x41247b1d in QEventLoop::processEvents ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#24 0x412b5640 in QEventLoop::enterLoop () from /usr/lib/qt3/lib/libqt-mt.so.3
#25 0x412a2e6f in QApplication::enter_loop ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#26 0x4148f605 in QDialog::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#27 0x4227ae6e in CppSupportPart::addMethod (this=0x877bad8, klass=
      {ptr = 0x8b6e370})
    at /download/org/kdevelop/repository/kdevelop/languages/cpp/cppsupportpart.cpp:776
#28 0x42603bb1 in ClassViewWidget::slotAddMethod (this=0x88225e8)
    at /download/org/kdevelop/repository/kdevelop/parts/classview/classviewwidget.cpp:898
#29 0x4260596b in ClassViewWidget::qt_invoke (this=0x88225e8, _id=106, 
    _o=0xbfffa370) at classviewwidget.moc:127
#30 0x4130430b in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#31 0x413040d4 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#32 0x40bd91b9 in KAction::activated () from /opt/kde3/lib/libkdeui.so.4
#33 0x40bd8c2d in KAction::slotActivated () from /opt/kde3/lib/libkdeui.so.4
#34 0x40bd9271 in KAction::qt_invoke () from /opt/kde3/lib/libkdeui.so.4
#35 0x4130430b in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#36 0x413040d4 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#37 0x40eb97d9 in KAccelPrivate::menuItemActivated ()
   from /opt/kde3/lib/libkdecore.so.4
#38 0x40eb7fe5 in KAccelPrivate::eventFilter ()
   from /opt/kde3/lib/libkdecore.so.4
#39 0x41301aae in QObject::activate_filters ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#40 0x413019a0 in QObject::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#41 0x4133b60f in QWidget::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#42 0x413f85f2 in QMainWindow::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#43 0x0810648e in KMdiMainFrm::event (this=0x82a2228, e=0xbfffaa20)
    at /download/org/kdevelop/repository/kdevelop/lib/qextmdi/kmdimainfrm.cpp:1089
#44 0x412a2b76 in QApplication::internalNotify ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#45 0x412a23d7 in QApplication::notify () from /usr/lib/qt3/lib/libqt-mt.so.3
#46 0x40e3e824 in KApplication::notify () from /opt/kde3/lib/libkdecore.so.4
#47 0x40eb7067 in KAccelEventHandler::x11Event ()
   from /opt/kde3/lib/libkdecore.so.4
#48 0x40e44542 in KApplication::x11EventFilter ()
   from /opt/kde3/lib/libkdecore.so.4
#49 0x41224aa8 in qt_x11EventFilter () from /usr/lib/qt3/lib/libqt-mt.so.3
#50 0x4122ed7c in QApplication::x11ProcessEvent ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#51 0x41247b1d in QEventLoop::processEvents ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#52 0x412b5640 in QEventLoop::enterLoop () from /usr/lib/qt3/lib/libqt-mt.so.3
#53 0x412b5536 in QEventLoop::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#54 0x412a2e0f in QApplication::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#55 0x08099e66 in main (argc=1, argv=0xbfffb0b4)
    at /download/org/kdevelop/repository/kdevelop/src/main.cpp:127
Comment 1 Jens Dagerbo 2004-05-19 18:48:17 UTC
CVS commit by dagerbo: 

Don't crash when user attempts "add method" without selecting a class 
(this is possible through the use of keyboard shortcuts)

CCMAIL: 81579-done@bugs.kde.org


  M +8 -0      classviewwidget.cpp   1.50


--- kdevelop/parts/classview/classviewwidget.cpp  #1.49:1.50
@@ -895,4 +895,6 @@ void ClassViewWidget::slotNewClass( )
 void ClassViewWidget::slotAddMethod( )
 {
+    if ( !selectedItem() ) return;
+
     if( m_part->languageSupport()->features() & KDevLanguageSupport::AddMethod )
         m_part->languageSupport()->addMethod( static_cast<ClassDomBrowserItem*>( selectedItem() )->dom() );
@@ -901,4 +903,6 @@ void ClassViewWidget::slotAddMethod( )
 void ClassViewWidget::slotAddAttribute( )
 {
+    if ( !selectedItem() ) return;
+    
     if( m_part->languageSupport()->features() & KDevLanguageSupport::AddAttribute )
         m_part->languageSupport()->addAttribute( static_cast<ClassDomBrowserItem*>( selectedItem() )->dom() );
@@ -907,4 +911,6 @@ void ClassViewWidget::slotAddAttribute( 
 void ClassViewWidget::slotOpenDeclaration( )
 {
+    if ( !selectedItem() ) return;
+    
     static_cast<ClassViewItem*>( selectedItem() )->openDeclaration();
 }
@@ -912,4 +918,6 @@ void ClassViewWidget::slotOpenDeclaratio
 void ClassViewWidget::slotOpenImplementation( )
 {
+    if ( !selectedItem() ) return;
+    
     static_cast<ClassViewItem*>( selectedItem() )->openImplementation();
 }


Comment 2 Jens Dagerbo 2004-05-19 18:50:05 UTC
CVS commit by dagerbo: 

BACKPORT

Don't crash when user attempts "add method" without selecting a class 
(this is possible through the use of keyboard shortcuts)

CCMAIL: 81579@bugs.kde.org


  M +8 -2      classviewwidget.cpp   1.48.2.1


--- kdevelop/parts/classview/classviewwidget.cpp  #1.48:1.48.2.1
@@ -895,4 +895,6 @@ void ClassViewWidget::slotNewClass( )
 void ClassViewWidget::slotAddMethod( )
 {
+    if ( !selectedItem() ) return;
+
     if( m_part->languageSupport()->features() & KDevLanguageSupport::AddMethod )
         m_part->languageSupport()->addMethod( static_cast<ClassDomBrowserItem*>( selectedItem() )->dom() );
@@ -901,4 +903,6 @@ void ClassViewWidget::slotAddMethod( )
 void ClassViewWidget::slotAddAttribute( )
 {
+    if ( !selectedItem() ) return;
+    
     if( m_part->languageSupport()->features() & KDevLanguageSupport::AddAttribute )
         m_part->languageSupport()->addAttribute( static_cast<ClassDomBrowserItem*>( selectedItem() )->dom() );
@@ -907,4 +911,6 @@ void ClassViewWidget::slotAddAttribute( 
 void ClassViewWidget::slotOpenDeclaration( )
 {
+    if ( !selectedItem() ) return;
+    
     static_cast<ClassViewItem*>( selectedItem() )->openDeclaration();
 }
@@ -912,4 +918,6 @@ void ClassViewWidget::slotOpenDeclaratio
 void ClassViewWidget::slotOpenImplementation( )
 {
+    if ( !selectedItem() ) return;
+    
     static_cast<ClassViewItem*>( selectedItem() )->openImplementation();
 }
@@ -940,6 +948,4 @@ bool FunctionDomBrowserItem::hasImplemen
 void ClassViewWidget::maybeTip( QPoint const & p )
 {
-        kdDebug(0) << "ClassViewWidget::maybeTip()" << endl;
-
         ClassViewItem * item = dynamic_cast<ClassViewItem*>( itemAt( p ) );
         if ( !item ) return;