[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Fri Mar 18 21:23:44 CET 2005
CVS commit by staikos:
I'm stunned that no-one hit this race already. Protect the equation parser.
M +1 -0 datarangewidget.ui.h 1.5
M +9 -0 enodes.cpp 1.44
M +2 -0 enodes.h 1.29
M +3 -0 kstequation.cpp 1.31
M +1 -0 ksteventmonitorentry.cpp 1.36
--- kdeextragear-2/kst/kst/datarangewidget.ui.h #1.4:1.5
@@ -130,4 +130,5 @@ double KstDataRange::interpret(const cha
int rc = yyparse();
if (rc == 0) {
+ QMutexLocker ml(&Equation::mutex());
Equation::Node *eq = static_cast<Equation::Node*>(ParsedEquation);
ParsedEquation = 0L;
--- kdeextragear-2/kst/kst/enodes.cpp #1.43:1.44
@@ -26,4 +26,6 @@
#include <klocale.h>
+#include <qmutex.h>
+
#include "enodes.h"
#include "kstdatacollection.h"
@@ -34,4 +36,11 @@
using namespace Equation;
+static QMutex _mutex;
+
+QMutex& Equation::mutex() {
+ return _mutex;
+}
+
+
Node::Node() {
_parentheses = false;
--- kdeextragear-2/kst/kst/enodes.h #1.28:1.29
@@ -28,4 +28,6 @@ class Plugin;
namespace Equation {
+ QMutex& mutex();
+
class Context {
public:
--- kdeextragear-2/kst/kst/kstequation.cpp #1.30:1.31
@@ -230,4 +230,5 @@ void KstEquation::save(QTextStream &ts,
// the optimizer
if (!_equation.isEmpty()) {
+ QMutexLocker ml(&Equation::mutex());
yy_scan_string(_equation.latin1());
ParsedEquation = 0L;
@@ -271,4 +272,5 @@ void KstEquation::setEquation(const QStr
_pe = 0L;
if (!_equation.isEmpty()) {
+ QMutexLocker ml(&Equation::mutex());
yy_scan_string(_equation.latin1());
int rc = yyparse();
@@ -445,4 +447,5 @@ bool KstEquation::FillY(bool force) {
}
+ QMutexLocker ml(&Equation::mutex());
yy_scan_string(_equation.latin1());
int rc = yyparse();
--- kdeextragear-2/kst/kst/ksteventmonitorentry.cpp #1.35:1.36
@@ -160,4 +160,5 @@ KstObject::UpdateType EventMonitorEntry:
if (!_pExpression) {
if (!_strEvent.isEmpty()) {
+ QMutexLocker ml(&Equation::mutex());
yy_scan_string(_strEvent.latin1());
int rc = yyparse();
More information about the Kst
mailing list