summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine_p.h
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-09-22 14:56:37 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-09-22 14:59:39 (GMT)
commit77b1f0ab8c8055835a3fc92d784d536efdc6acbf (patch)
treee844d05c320702802f5fd6b041d6085054c9d560 /src/script/api/qscriptengine_p.h
parent5c3c0d477104f6f4eafaceeacac8278c4b97f8cc (diff)
downloadQt-77b1f0ab8c8055835a3fc92d784d536efdc6acbf.zip
Qt-77b1f0ab8c8055835a3fc92d784d536efdc6acbf.tar.gz
Qt-77b1f0ab8c8055835a3fc92d784d536efdc6acbf.tar.bz2
make sure the engine's currentFrame is in sync when calling out to public API
The currentFrame pointer is used e.g. by QScriptValue::toString(). It needs to be in sync, otherwise we will crash. Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script/api/qscriptengine_p.h')
-rw-r--r--src/script/api/qscriptengine_p.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index c7db276..ec41cc9 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -265,6 +265,29 @@ public:
#endif
};
+namespace QScript
+{
+
+class SaveFrameHelper
+{
+public:
+ SaveFrameHelper(QScriptEnginePrivate *eng,
+ JSC::ExecState *newFrame)
+ : engine(eng), oldFrame(eng->currentFrame)
+ {
+ eng->currentFrame = newFrame;
+ }
+ ~SaveFrameHelper()
+ {
+ engine->currentFrame = oldFrame;
+ }
+private:
+ QScriptEnginePrivate *engine;
+ JSC::ExecState *oldFrame;
+};
+
+} // namespace QScript
+
inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(size_t size)
{
if (freeScriptValues) {