Bug 113387

Summary: KmPlot crashes when the Remove action is added in a toolbar and used to remove a graph
Product: [Applications] kmplot Reporter: Anne-Marie Mahfouf <annma>
Component: generalAssignee: Klaus-Dieter M <kd.moeller>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Anne-Marie Mahfouf 2005-09-26 21:26:03 UTC
Version:           1.2.0 (using KDE 3.4.91 (beta1, >= 20050910), compiled sources)
Compiler:          Target: i586-mandriva-linux-gnu
OS:                Linux (i686) release 2.6.11-9.mm.6mdk

Using Settings -> Configure Toolbars, I add the Remove action to maintoolbar (kmplot).
When you click on that button to delete the current graph, KmPlot crashes with the following back trace:

Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1231739200 (LWP 18442)]
[KCrash handler]
#7  0xb6754d29 in View::mnuRemove_clicked ()
   from /usr/local/kde3.5/lib/kde3/libkmplotpart.so
#8  0xb6770d8d in View::qt_invoke ()
   from /usr/local/kde3.5/lib/kde3/libkmplotpart.so
#9  0xb71794d7 in QObject::activate_signal (this=0x81b3a88, clist=0x81b3c60, 
    o=0xbfffe93c) at kernel/qobject.cpp:2356
#10 0xb7179fbb in QObject::activate_signal (this=0x81b3a88, signal=2)
    at kernel/qobject.cpp:2325
#11 0xb7aa8d95 in KAction::activated ()
   from /usr/local/kde3.5/lib/libkdeui.so.4
#12 0xb7aa8ebb in KAction::slotActivated ()
   from /usr/local/kde3.5/lib/libkdeui.so.4
#13 0xb7aae5a5 in KAction::slotButtonClicked ()
   from /usr/local/kde3.5/lib/libkdeui.so.4
#14 0xb7aae900 in KAction::qt_invoke ()
   from /usr/local/kde3.5/lib/libkdeui.so.4
#15 0xb71794d7 in QObject::activate_signal (this=0x823e9d0, clist=0x8234f50, 
    o=0xbfffea80) at kernel/qobject.cpp:2356
#16 0xb7b5ebfc in KToolBarButton::buttonClicked ()
   from /usr/local/kde3.5/lib/libkdeui.so.4
#17 0xb7b5efa9 in KToolBarButton::mouseReleaseEvent ()
   from /usr/local/kde3.5/lib/libkdeui.so.4
#18 0xb71b4c36 in QWidget::event (this=0x823e9d0, e=0xbfffef64)
    at kernel/qwidget.cpp:4677
#19 0xb7b5f6ed in KToolBarButton::event ()
   from /usr/local/kde3.5/lib/libkdeui.so.4
#20 0xb710f4e4 in QApplication::internalNotify (this=0xbffff47c, 
    receiver=0x823e9d0, e=0xbfffef64) at kernel/qapplication.cpp:2635
#21 0xb710faa8 in QApplication::notify (this=0xbffff47c, receiver=0x823e9d0, 
    e=0xbfffef64) at kernel/qapplication.cpp:2421
#22 0xb77d49f7 in KApplication::notify ()
   from /usr/local/kde3.5/lib/libkdecore.so.4
#23 0xb70a1e51 in QApplication::sendSpontaneousEvent (receiver=0x823e9d0, 
    event=0xbfffef64) at qapplication.h:499
#24 0xb709dbb8 in QETWidget::translateMouseEvent (this=0x823e9d0, 
    event=0xbffff2b8) at kernel/qapplication_x11.cpp:4296
#25 0xb709bea3 in QApplication::x11ProcessEvent (this=0xbffff47c, 
    event=0xbffff2b8) at kernel/qapplication_x11.cpp:3447
#26 0xb70b4b24 in QEventLoop::processEvents (this=0x80f45d8, flags=4)
    at kernel/qeventloop_x11.cpp:192
#27 0xb7127856 in QEventLoop::enterLoop (this=0x80f45d8)
    at kernel/qeventloop.cpp:198
#28 0xb712777f in QEventLoop::exec (this=0x80f45d8)
    at kernel/qeventloop.cpp:145
#29 0xb710e06d in QApplication::exec (this=0xbffff47c)
    at kernel/qapplication.cpp:2758
#30 0x08051a3d in main ()
Comment 1 Fredrik Edemar 2005-09-29 22:12:20 UTC
SVN commit 465447 by fedemar:

Bug 113387: KmPlot crashes when the Remove action is added in a toolbar and used to remove a graph.

BUG: 113387


 M  +14 -0     View.cpp  


--- branches/KDE/3.5/kdeedu/kmplot/kmplot/View.cpp #465446:465447
@@ -1829,6 +1829,9 @@
 
 void View::mnuHide_clicked()
 {
+    if ( csmode == -1 )
+      return;
+    
 	Ufkt *ufkt = &m_parser->ufkt[ m_parser->ixValue(csmode)];
 	switch (cstype )
 	{
@@ -1865,6 +1868,9 @@
 }
 void View::mnuRemove_clicked()
 {
+  if ( csmode == -1 )
+    return;
+  
 	if ( KMessageBox::warningContinueCancel(this,i18n("Are you sure you want to remove this function?"), QString::null, KStdGuiItem::del()) == KMessageBox::Continue )
 	{
 		Ufkt *ufkt =  &m_parser->ufkt[m_parser->ixValue(csmode)];
@@ -1888,6 +1894,8 @@
 }
 void View::mnuEdit_clicked()
 {
+  if ( csmode == -1 )
+    return;
 	if ( m_parser->ufkt[m_parser->ixValue(csmode)].fstr[0] == 'x') // a parametric function
 	{
 		int y_index = csmode+1; //the y-function
@@ -1919,12 +1927,18 @@
 
 void View::mnuCopy_clicked()
 {
+  if ( csmode == -1 )
+  return;
+  
 	if ( m_parser->sendFunction(csmode) )
 		m_modified = true;
 }
 
 void View::mnuMove_clicked()
 {
+  if ( csmode == -1 )
+    return;
+  
 	if ( m_parser->sendFunction(csmode) )
 	{
 	  	if (!m_parser->delfkt(csmode) )