summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-08-04 11:14:08 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-08-04 13:35:05 (GMT)
commit109b4d19e2c677c3eafaf6b4a9df605cb3aeb481 (patch)
treee3d31d7417058b23eeaecd2e8e3b5533264415cd /src
parente2852e547216562751a5d05ebdfbd001113cc9b6 (diff)
downloadQt-109b4d19e2c677c3eafaf6b4a9df605cb3aeb481.zip
Qt-109b4d19e2c677c3eafaf6b4a9df605cb3aeb481.tar.gz
Qt-109b4d19e2c677c3eafaf6b4a9df605cb3aeb481.tar.bz2
Do not crash if using popContext() while the current context have not been pushed
Reviewed-by: Kent Hansen
Diffstat (limited to 'src')
-rw-r--r--src/script/api/qscriptengine.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 97d8061..bebb972 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -2369,6 +2369,11 @@ QScriptContext *QScriptEngine::pushContext()
void QScriptEngine::popContext()
{
Q_D(QScriptEngine);
+ if (d->currentFrame->returnPC() != 0 || d->currentFrame->codeBlock() != 0
+ || d->currentFrame->returnValueRegister() != 0 || !currentContext()->parentContext()) {
+ qWarning("QScriptEngine::popContext() doesn't match with pushContext()");
+ return;
+ }
JSC::RegisterFile &registerFile = d->currentFrame->interpreter()->registerFile();
JSC::Register *const newEnd = d->currentFrame->registers() - JSC::RegisterFile::CallFrameHeaderSize - d->currentFrame->argumentCount();
d->currentFrame->scopeChain()->pop()->deref();