Bug 68041 - kst crashes when DataMode is used when there is an equation present
Summary: kst crashes when DataMode is used when there is an equation present
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: RedHat Enterprise Linux Linux
: NOR crash
Target Milestone: ---
Assignee: George Staikos
URL:
Keywords:
: 68043 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-11-12 19:19 UTC by Matthew Truch
Modified: 2003-11-13 22:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Truch 2003-11-12 19:29:24 UTC
Version:           0.94 (using KDE KDE 3.1.4)
Installed from:    RedHat RPMs
OS:          Linux

kst crashes when DataMode is used when there is an equation present.

To Reproduce:  run kst, and plot some data.  Make an equation and plot that too (It can be as simple as [my-y-vector]-[my-y-vector-Mean]).  Activate DataMode.  

Expected Behavior: kst doesn't crash, and shows DataMode points for either the equation or the curve (as appropriate).
Comment 1 Matthew Truch 2003-11-12 19:47:14 UTC
I just compiled an --enable-debug version of kst to produce a useful backtrace, and found out that this crash doesn't happen when --enable-debug was given at compile time.  Ditto for the (possibly related) bug 68040 (DataMode doesn't show correct y-axis data).
Comment 2 George Staikos 2003-11-12 21:17:05 UTC
*** Bug 68043 has been marked as a duplicate of this bug. ***
Comment 3 George Staikos 2003-11-12 21:32:50 UTC
I can't reproduce, and I have debug enabled.  However I ran it in valgrind and I don't get any hits there either.  I think you might have a local problem.
Comment 4 Matthew Truch 2003-11-12 21:57:13 UTC
I don't think it's a local problem.  I just tried it on debian stable machine with the source compiled from scratch (./configure --enable-final && make && make install) as opposed to my RedHat 9 rpms, and the crash condition is identical.  
Comment 5 George Staikos 2003-11-12 22:08:40 UTC
Subject: Re: [Kst]  kst crashes when DataMode is used when there is an equation present

On Wednesday 12 November 2003 15:57, Matthew Truch wrote:
> I don't think it's a local problem.  I just tried it on debian stable
> machine with the source compiled from scratch (./configure --enable-final
> && make && make install) as opposed to my RedHat 9 rpms, and the crash
> condition is identical. _______________________________________________

   Can you send me the data files you used?
Comment 6 Matthew Truch 2003-11-12 22:28:34 UTC
I can, but they are quite large (dirfile format, ~40MB per file...you'd only need one, I guess).  I tried to reproduce this using a simple test ascii file, and couldn't reproduce it; perhaps it has something to do with the dirfile (getdata?) code?
Comment 7 George Staikos 2003-11-12 22:31:04 UTC
Subject: Re: [Kst]  kst crashes when DataMode is used when there is an equation present

On Wednesday 12 November 2003 16:28, Matthew Truch wrote:
> I can, but they are quite large (dirfile format, ~40MB per file...you'd
> only need one, I guess).  I tried to reproduce this using a simple test
> ascii file, and couldn't reproduce it; perhaps it has something to do with
> the dirfile (getdata?) code?

  This is what I'm wondering too.  If you can make a testcase and compress it, 
you can send me an http link and I can download it.  I think that's most 
efficient.

Comment 8 George Staikos 2003-11-12 23:06:26 UTC
I see it now.
Comment 9 George Staikos 2003-11-13 22:30:12 UTC
Subject: kdeextragear-2/kst/kst

CVS commit by staikos: 

Don't crash in data mode, do data mode properly in non-log mode
- took a chapter from the overcomplication book here it seems, resulting in a
  very difficult bug to track down

CCMAIL: 68041-done@bugs.kde.org


  M +4 -2      kstequationcurve.cpp   1.38
  M +1 -5      kstview.cpp   1.56


--- kdeextragear-2/kst/kst/kstequationcurve.cpp  #1.37:1.38
@@ -207,6 +207,8 @@ KstObject::UpdateType KstEquationCurve::
 // FIXME: Optimize me, especially map lookups.
 void KstEquationCurve::getPoint(int i, double &x, double &y) {
-  x = _inputVectors[XVECTOR]->interpolate(i, NS);
-  y = _outputVectors[OUTVECTOR]->value()[i];
+  KstVectorPtr xv = _inputVectors[XVECTOR];
+  KstVectorPtr yv = _outputVectors[OUTVECTOR];
+  x = xv->interpolate(i, NS);
+  y = yv->value()[i];
 }
 

--- kdeextragear-2/kst/kst/kstview.cpp  #1.55:1.56
@@ -405,9 +405,5 @@ void KstView::updateMouse() {
       for (KstBaseCurveList::Iterator i = pPlot->Curves.begin(); i != pPlot->Curves.end(); ++i) {
         double xpt = 0.0, ypt = 0.0;
-        if (pPlot->isXLog()) {
           (*i)->getPoint((*i)->sampleCount() * xpos / ((*i)->maxX() - (*i)->minX()), xpt, ypt);
-        } else {
-          (*i)->getPoint(xpos, xpt, ypt);
-        }
         if (fabs(ypos - ypt) < delta) {
           delta = fabs(ypos - ypt);