[Kst] kst_1_0_branch: kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Sat Dec 4 06:08:17 CET 2004


CVS commit by staikos: 

backport crash fix for equations


  M +6 -7      kstequation.cpp   1.11.4.1


--- kdeextragear-2/kst/kst/kstequation.cpp  #1.11:1.11.4.1
@@ -175,5 +175,5 @@ KstObject::UpdateType KstEquation::updat
   bool force = false;
 
-  if (KstObject::checkUpdateCounter(update_counter)) {
+  if (!_pe || KstObject::checkUpdateCounter(update_counter)) {
     return NO_CHANGE;
   }
@@ -238,6 +238,6 @@ void KstEquation::setEquation(const QStr
     yy_scan_string(_equation.latin1());
     int rc = yyparse();
-    if (rc == 0) {
       _pe = static_cast<Equation::Node*>(ParsedEquation);
+    if (_pe && rc == 0) {
       Equation::Context ctx;
       ctx.sampleCount = _ns;
@@ -246,9 +246,8 @@ void KstEquation::setEquation(const QStr
       _pe->collectVectors(VectorsUsed);
       _pe->update(-1, &ctx);
-      ParsedEquation = 0L;
     } else {
       delete (Equation::Node*)ParsedEquation;
-      ParsedEquation = 0L;
     }
+    ParsedEquation = 0L;
   }
   _isValid = _pe != 0L;
@@ -407,6 +406,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);





More information about the Kst mailing list