Bug 94351 - attempting to plot a non-existent equation crashes.
Summary: attempting to plot a non-existent equation crashes.
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.0.0
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-03 21:20 UTC by D. V. Wiebe
Modified: 2004-12-04 06:06 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 D. V. Wiebe 2004-12-03 21:20:33 UTC
Version:           1.0.0 (using KDE 3.3.1, compiled sources)
Compiler:          gcc version 3.3.4
OS:                Linux (i686) release 2.6.9

Trying to create a plot from an equation that hasn't been specified crashes kst.

Steps to reproduce:

1.  start kst with no command line options.
2.  Data Manager
3.  New Equation...
4.  Click OK (here, by default, there's nothing in the "Equation:" box and the independant variable vector is 1000 samples generated from -10.0 to 10.0)

Reproduceable every time.
Comment 1 George Staikos 2004-12-04 06:06:12 UTC
CVS commit by staikos: 

Don't crash on empty equation
BUG: 94351


  M +6 -7      kstequation.cpp   1.16


--- kdeextragear-2/kst/kst/kstequation.cpp  #1.15:1.16
@@ -177,5 +177,5 @@ KstObject::UpdateType KstEquation::updat
   bool force = false;
 
-  if (KstObject::checkUpdateCounter(update_counter)) {
+  if (!_pe || KstObject::checkUpdateCounter(update_counter)) {
     return NO_CHANGE;
   }
@@ -240,6 +240,6 @@ void KstEquation::setEquation(const QStr
     yy_scan_string(_equation.latin1());
     int rc = yyparse();
-    if (rc == 0) {
       _pe = static_cast<Equation::Node*>(ParsedEquation);
+    if (rc == 0 && _pe) {
       Equation::Context ctx;
       ctx.sampleCount = _ns;
@@ -248,5 +248,4 @@ void KstEquation::setEquation(const QStr
       _pe->collectVectors(VectorsUsed);
       _pe->update(-1, &ctx);
-      ParsedEquation = 0L;
     } else {
       // Parse error
@@ -256,6 +255,6 @@ void KstEquation::setEquation(const QStr
       }
       delete (Equation::Node*)ParsedEquation;
-      ParsedEquation = 0L;
     }
+    ParsedEquation = 0L;
   }
   _isValid = _pe != 0L;
@@ -414,6 +413,6 @@ bool KstEquation::FillY(bool force) {
     yy_scan_string(_equation.latin1());
     int rc = yyparse();
-    if (rc == 0) {
       _pe = static_cast<Equation::Node*>(ParsedEquation);
+    if (_pe && rc == 0) {
       Equation::FoldVisitor vis(&ctx, &_pe);
       _pe->collectVectors(VectorsUsed);