diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-09-22 14:56:37 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-09-22 14:59:39 (GMT) |
commit | 77b1f0ab8c8055835a3fc92d784d536efdc6acbf (patch) | |
tree | e844d05c320702802f5fd6b041d6085054c9d560 /src/script/api/qscriptengine_p.h | |
parent | 5c3c0d477104f6f4eafaceeacac8278c4b97f8cc (diff) | |
download | Qt-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.h | 23 |
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) { |