<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>81579</bug_id>
          
          <creation_ts>2004-05-14 16:04:08 +0000</creation_ts>
          <short_desc>Crash using shortcut for Add Method...</short_desc>
          <delta_ts>2004-05-19 18:50:05 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>kdevelop</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>unspecified</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>crash</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Steven T. Hatton">hattons</reporter>
          <assigned_to name="KDevelop Developers">kdevelop-devel</assigned_to>
          
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>232133</commentid>
    <comment_count>0</comment_count>
    <who name="Steven T. Hatton">hattons</who>
    <bug_when>2004-05-14 16:04:08 +0000</bug_when>
    <thetext>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 -&gt; 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 &quot;/lib/libthread_db.so.1&quot;.
[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  &lt;signal handler called&gt;
#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 &quot;/lib/libthread_db.so.1&quot;.
[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  &lt;signal handler called&gt;
#4  0x080e1c11 in QMapPrivate (this=0x8c3c200, _map=0x8168e20) at qmap.h:441
#5  0x080df0d7 in QMap&lt;QString, QValueList&lt;KSharedPtr&lt;FunctionModel&gt; &gt; &gt;::detachInternal (this=0x8b6e3a4) at qmap.h:840
#6  0x080dafdf in QMap&lt;QString, QValueList&lt;KSharedPtr&lt;FunctionModel&gt; &gt; &gt;::detach (this=0x8b6e3a4) at qmap.h:739
#7  0x080d6f5b in QMap&lt;QString, QValueList&lt;KSharedPtr&lt;FunctionModel&gt; &gt; &gt;::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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>234470</commentid>
    <comment_count>1</comment_count>
    <who name="Jens Dagerbo">jens.dagerbo</who>
    <bug_when>2004-05-19 18:48:17 +0000</bug_when>
    <thetext>CVS commit by dagerbo: 

Don&apos;t crash when user attempts &quot;add method&quot; 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-&gt;languageSupport()-&gt;features() &amp; KDevLanguageSupport::AddMethod )
         m_part-&gt;languageSupport()-&gt;addMethod( static_cast&lt;ClassDomBrowserItem*&gt;( selectedItem() )-&gt;dom() );
@@ -901,4 +903,6 @@ void ClassViewWidget::slotAddMethod( )
 void ClassViewWidget::slotAddAttribute( )
 {
+    if ( !selectedItem() ) return;
+    
     if( m_part-&gt;languageSupport()-&gt;features() &amp; KDevLanguageSupport::AddAttribute )
         m_part-&gt;languageSupport()-&gt;addAttribute( static_cast&lt;ClassDomBrowserItem*&gt;( selectedItem() )-&gt;dom() );
@@ -907,4 +911,6 @@ void ClassViewWidget::slotAddAttribute( 
 void ClassViewWidget::slotOpenDeclaration( )
 {
+    if ( !selectedItem() ) return;
+    
     static_cast&lt;ClassViewItem*&gt;( selectedItem() )-&gt;openDeclaration();
 }
@@ -912,4 +918,6 @@ void ClassViewWidget::slotOpenDeclaratio
 void ClassViewWidget::slotOpenImplementation( )
 {
+    if ( !selectedItem() ) return;
+    
     static_cast&lt;ClassViewItem*&gt;( selectedItem() )-&gt;openImplementation();
 }


</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>234471</commentid>
    <comment_count>2</comment_count>
    <who name="Jens Dagerbo">jens.dagerbo</who>
    <bug_when>2004-05-19 18:50:05 +0000</bug_when>
    <thetext>CVS commit by dagerbo: 

BACKPORT

Don&apos;t crash when user attempts &quot;add method&quot; 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-&gt;languageSupport()-&gt;features() &amp; KDevLanguageSupport::AddMethod )
         m_part-&gt;languageSupport()-&gt;addMethod( static_cast&lt;ClassDomBrowserItem*&gt;( selectedItem() )-&gt;dom() );
@@ -901,4 +903,6 @@ void ClassViewWidget::slotAddMethod( )
 void ClassViewWidget::slotAddAttribute( )
 {
+    if ( !selectedItem() ) return;
+    
     if( m_part-&gt;languageSupport()-&gt;features() &amp; KDevLanguageSupport::AddAttribute )
         m_part-&gt;languageSupport()-&gt;addAttribute( static_cast&lt;ClassDomBrowserItem*&gt;( selectedItem() )-&gt;dom() );
@@ -907,4 +911,6 @@ void ClassViewWidget::slotAddAttribute( 
 void ClassViewWidget::slotOpenDeclaration( )
 {
+    if ( !selectedItem() ) return;
+    
     static_cast&lt;ClassViewItem*&gt;( selectedItem() )-&gt;openDeclaration();
 }
@@ -912,4 +918,6 @@ void ClassViewWidget::slotOpenDeclaratio
 void ClassViewWidget::slotOpenImplementation( )
 {
+    if ( !selectedItem() ) return;
+    
     static_cast&lt;ClassViewItem*&gt;( selectedItem() )-&gt;openImplementation();
 }
@@ -940,6 +948,4 @@ bool FunctionDomBrowserItem::hasImplemen
 void ClassViewWidget::maybeTip( QPoint const &amp; p )
 {
-        kdDebug(0) &lt;&lt; &quot;ClassViewWidget::maybeTip()&quot; &lt;&lt; endl;
-
         ClassViewItem * item = dynamic_cast&lt;ClassViewItem*&gt;( itemAt( p ) );
         if ( !item ) return;


</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>