Bug 128374

Summary: Crash when trying to modify a legend
Product: [Applications] kst Reporter: Nicolas Brisset <nicolas.brisset>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: unspecified   
OS: Solaris   
Latest Commit: Version Fixed In:

Description Nicolas Brisset 2006-05-31 14:49:53 UTC
Version:           1.3.0_devel (using KDE 3.4.0, compiled sources)
Compiler:          gcc version 3.4.3
OS:                SunOS (sun4u) release 5.8

While trying to figure out how legends should work, I triggered a crash which someone had apparently been expecting :-)
Assertion failed: !_menu, file kstviewwidget.cpp, line 327


To reproduce:
1) load all 3 columns from gyrodata.dat into a single plot
2) make it show the legend
3) RMB on the legend, call "Modify" to open the legend dialog
4) while the dialog is shown, repeat RMB on the legend

It seems it does not crash when the dialog has been called from within the plot dialog (though I'm not sure it is 100% true)
Comment 1 George Staikos 2006-05-31 15:12:43 UTC
SVN commit 546935 by staikos:

Ok now I see how this can happen.  Don't allow recursive menus at all.  It's too
dangerous.
BUG: 128374


 M  +4 -1      kstviewwidget.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewwidget.cpp #546934:546935
@@ -324,7 +324,10 @@
   if (_view->mouseGrabber()) {
     _view->releaseMouse(_view->mouseGrabber());
   }
-  assert(!_menu);
+  if (_menu) { // Do not allow recursive menus
+    e->ignore();
+    return;
+  }
   _menu = new KPopupMenu(this);
   //kstdDebug() << "Querying for the popup" << endl;
   bool rc = _view->popupMenu(_menu, e->pos());