Bug 134686

Summary: crash when copying a plot from one window to another
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:
Sentry Crash Report:

Description Nicolas Brisset 2006-09-26 15:44:36 UTC
Version:           1.3.0 (using KDE 3.4.0, compiled sources)
Compiler:          gcc version 3.4.3
OS:                SunOS (sun4u) release 5.8

This is not 100% reproducible, but happens quite often. Try the following steps a couple of times (2 or 3) and you should see it. Trials take time, so I have not testedall combinations, but sometimes according to how you perform the actions (menu, keyboard shortcut or RMB) it seems to behave differently. I guess it's just due to the somehow random nature of the crash, but I'd still advise to follow the procedure very exactly:
1) start "kst -w gyrodata.dat"
2) load column 1 vs INDEX in a new plot (in W1)
3) invoke the datawizard once again, and plot column 2 vs INDEX in a new plot, in a new window (W2)
4) go to W1, RMB on the W1 tab, select "New..." and name the new window "W_UTM"
5) Plots menu -> Layout mode
6) RMB on plot P1 in W1, select "Copy to...->W_UTM": crash!

Below is the trace I get, in case it helps:
#0  0xff10b54c in Kst2DPlot::plotPlotMarkers () from /S/KDE/beta/lib/libkstapp.so.1
#1  0xff10c9ec in Kst2DPlot::draw () from /S/KDE/beta/lib/libkstapp.so.1
#2  0xff10cec0 in Kst2DPlot::draw () from /S/KDE/beta/lib/libkstapp.so.1
#3  0xff113b74 in Kst2DPlot::updateSelf () from /S/KDE/beta/lib/libkstapp.so.1
#4  0xff13ae00 in KstViewObject::paintUpdate () from /S/KDE/beta/lib/libkstapp.so.1
#5  0xff1456e0 in KstViewObject::paint () from /S/KDE/beta/lib/libkstapp.so.1
#6  0xff145b74 in KstViewObject::paint () from /S/KDE/beta/lib/libkstapp.so.1
#7  0xff14d744 in KstTopLevelView::paint () from /S/KDE/beta/lib/libkstapp.so.1
#8  0xff14d814 in KstTopLevelView::paint () from /S/KDE/beta/lib/libkstapp.so.1
#9  0xff1473d4 in KstViewObject::copyTo () from /S/KDE/beta/lib/libkstapp.so.1
#10 0xff145cfc in KstViewObject::qt_invoke () from /S/KDE/beta/lib/libkstapp.so.1
#11 0xff14ce20 in KstBorderedViewObject::qt_invoke () from /S/KDE/beta/lib/libkstapp.so.1
#12 0xff15f2ec in KstMetaPlot::qt_invoke () from /S/KDE/beta/lib/libkstapp.so.1
#13 0xff0ea7a8 in KstPlotBase::qt_invoke () from /S/KDE/beta/lib/libkstapp.so.1
#14 0xff118700 in Kst2DPlot::qt_invoke () from /S/KDE/beta/lib/libkstapp.so.1
#15 0xfd69c5c4 in QObject::activate_signal () from /usr/local/kde/lib/libqt-mt.so.3
#16 0xfd69cd04 in QObject::activate_signal () from /usr/local/kde/lib/libqt-mt.so.3
#17 0xfd6b2dbc in QSignal::activate () from /usr/local/kde/lib/libqt-mt.so.3
#18 0xfd792078 in QPopupMenu::mouseReleaseEvent () from /usr/local/kde/lib/libqt-mt.so.3
#19 0xfd6d1840 in QWidget::event () from /usr/local/kde/lib/libqt-mt.so.3
#20 0xfd643024 in QApplication::internalNotify () from /usr/local/kde/lib/libqt-mt.so.3
#21 0xfd6433b4 in QApplication::notify () from /usr/local/kde/lib/libqt-mt.so.3
#22 0xfe0bd6d0 in KApplication::notify () from /usr/local/kde/V3.4.0/lib/libkdecore.so.4
#23 0xfd5e1e00 in QETWidget::translateMouseEvent () from /usr/local/kde/lib/libqt-mt.so.3
#24 0xfd5e0210 in QApplication::x11ProcessEvent () from /usr/local/kde/lib/libqt-mt.so.3
#25 0xfd5f1f64 in QEventLoop::processEvents () from /usr/local/kde/lib/libqt-mt.so.3
#26 0xfd658e7c in QEventLoop::enterLoop () from /usr/local/kde/lib/libqt-mt.so.3
#27 0xfd641fdc in QApplication::enter_loop () from /usr/local/kde/lib/libqt-mt.so.3
#28 0xfd7953d8 in QPopupMenu::exec () from /usr/local/kde/lib/libqt-mt.so.3
#29 0xfd795498 in QPopupMenu::exec () from /usr/local/kde/lib/libqt-mt.so.3
#30 0xff138ee4 in KstViewWidget::contextMenuEvent () from /S/KDE/beta/lib/libkstapp.so.1
#31 0xfd6d1340 in QWidget::event () from /usr/local/kde/lib/libqt-mt.so.3
#32 0xfd643024 in QApplication::internalNotify () from /usr/local/kde/lib/libqt-mt.so.3
#33 0xfd6438b8 in QApplication::notify () from /usr/local/kde/lib/libqt-mt.so.3
#34 0xfe0bd6d0 in KApplication::notify () from /usr/local/kde/V3.4.0/lib/libkdecore.so.4
#35 0xfd5e21ec in QETWidget::translateMouseEvent () from /usr/local/kde/lib/libqt-mt.so.3
#36 0xfd5e0210 in QApplication::x11ProcessEvent () from /usr/local/kde/lib/libqt-mt.so.3
#37 0xfd5f1f64 in QEventLoop::processEvents () from /usr/local/kde/lib/libqt-mt.so.3
#38 0xfd658e7c in QEventLoop::enterLoop () from /usr/local/kde/lib/libqt-mt.so.3
#39 0xfd658d64 in QEventLoop::exec () from /usr/local/kde/lib/libqt-mt.so.3
#40 0xfd641fb8 in QApplication::exec () from /usr/local/kde/lib/libqt-mt.so.3
#41 0x0001c31c in main ()
Comment 1 Nicolas Brisset 2006-09-26 16:23:30 UTC
The backtrace with line numbers and debug info:

#4  0x00247ade in Kst2DPlot::plotPlotMarkers (this=0x9de3c10, p=@0xbfee12c0, 
    m_X=0.0046650233251166254, b_X=46, x_max=199999, x_min=0, y_px=633, 
    ytop_bdr_px=22, ybot_bdr_px=41) at kst2dplot.cpp:5606
#5  0x0023a563 in Kst2DPlot::draw (this=0x9de3c10, p=@0xbfee12c0)
    at kst2dplot.cpp:2613
#6  0x002395b3 in Kst2DPlot::draw (this=0x9de3c10) at kst2dplot.cpp:2422
#7  0x00238f7d in Kst2DPlot::updateSelf (this=0x9de3c10) at kst2dplot.cpp:2349
#8  0x0026d0c0 in KstViewObject::paintUpdate (this=0x9de3c10)
    at kstviewobject.cpp:425
#9  0x0026cb86 in KstViewObject::paint (this=0x9de3c10, p=@0xbfee16a0, 
    bounds=@0xbfee15f0) at kstviewobject.cpp:340
#10 0x0026cd9c in KstViewObject::paint (this=0x9dacc78, p=@0xbfee16a0, 
    bounds=@0xbfee1810) at kstviewobject.cpp:370
#11 0x00279fff in KstTopLevelView::paint (this=0x9dacc78, p=@0xbfee16a0, 
    bounds=@0xbfee1810) at ksttoplevelview.cpp:134
#12 0x0027a117 in KstTopLevelView::paint (this=0x9dacdf0, type=161663896, 
    bounds=@0xbfee1810) at ksttoplevelview.cpp:153
#13 0x0027a049 in KstTopLevelView::paint (this=0x9dacc78, type=P_PAINT)
    at ksttoplevelview.cpp:143
#14 0x00271913 in KstViewObject::copyTo (this=0x9e53838, id=2)
    at kstviewobject.cpp:1404
#15 0x00273f6f in KstViewObject::qt_invoke (this=0x9e53838, _id=3870120, 
    _o=0xbfee1a40) at kstviewobject.moc:195
#16 0x00278f65 in KstBorderedViewObject::qt_invoke (this=0x9e53838, _id=26, 
    _o=0xbfee1a40) at kstborderedviewobject.moc:88
#17 0x00288c4d in KstMetaPlot::qt_invoke (this=0x9e53838, _id=26, 
    _o=0xbfee1a40) at kstmetaplot.moc:77
#18 0x00224c3d in KstPlotBase::qt_invoke (this=0x9e53838, _id=26, 
    _o=0xbfee1a40) at kstplotbase.moc:77
#19 0x0024ea73 in Kst2DPlot::qt_invoke (this=0x9e53838, _id=26, _o=0xbfee1a40)
    at kst2dplot.moc:302
Comment 2 George Staikos 2006-09-29 00:21:11 UTC
SVN commit 589910 by staikos:

The fake copy constructor strikes again...  uninit variables were causing
invalid memory references.
I'm not sure if there are more cases of this.
BUG: 134686


 M  +4 -1      kst2dplot.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.cpp #589909:589910
@@ -580,6 +580,9 @@
   _xReversed = plot._xReversed;
   _yReversed = plot._yReversed;
 
+  _lineWidthMarkers = plot._lineWidthMarkers;
+  _lineStyleMarkers = plot._lineStyleMarkers;
+
   Curves = plot.Curves;
 }
 
@@ -5612,7 +5615,7 @@
 void Kst2DPlot::plotPlotMarkers(KstPainter& p,
                            double m_X, double b_X, double x_max, double x_min,
                            double y_px, double ytop_bdr_px, double ybot_bdr_px) {
-  int width = lineWidthMarkers() * p.lineWidthAdjustmentFactor();
+  const int width = lineWidthMarkers() * p.lineWidthAdjustmentFactor();
 
   if (defaultColorMarker()) {
     p.setPen(QPen(foregroundColor(), width, KstLineStyle[lineStyleMarkers()]));