summaryrefslogtreecommitdiffstats
path: root/src/scripttools/debugging
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-06-17 14:57:23 +0200
committerKent Hansen <khansen@trolltech.com>2009-06-17 15:03:40 +0200
commitabc67ad77fa719db95254ac2995c0ce1a3ebaf5c (patch)
tree70cc9e259e77e95839942025996dd4fce9655404 /src/scripttools/debugging
parentf10441ab65d6204f23735e7cffbab5ac81663e91 (diff)
reset debugger's state correctly when previous engine was deleted
If the engine was deleted, the agent will be 0, but we still want to fall through rather than return immediately, so that the other variables are reset correctly.
Diffstat (limited to 'src/scripttools/debugging')
-rw-r--r--src/scripttools/debugging/qscriptdebuggerbackend.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/scripttools/debugging/qscriptdebuggerbackend.cpp b/src/scripttools/debugging/qscriptdebuggerbackend.cpp
index 9eaf571e8a..da9d50e423 100644
--- a/src/scripttools/debugging/qscriptdebuggerbackend.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerbackend.cpp
@@ -433,21 +433,21 @@ void QScriptDebuggerBackend::attachTo(QScriptEngine *engine)
void QScriptDebuggerBackend::detach()
{
Q_D(QScriptDebuggerBackend);
- if (!d->agent)
- return;
- QScriptEngine *eng = d->agent->engine();
- if (eng && eng->agent() == d->agent) {
- eng->setAgent(0);
- QScriptValue global = eng->globalObject();
- if (global.property(QString::fromLatin1("print")).strictlyEquals(traceFunction()))
- global.setProperty(QString::fromLatin1("print"), QScriptValue());
-// global.setProperty(QString::fromLatin1("qAssert"), QScriptValue());
- if (global.property(QString::fromLatin1("__FILE__")).strictlyEquals(fileNameFunction()))
- global.setProperty(QString::fromLatin1("__FILE__"), QScriptValue());
- if (global.property(QString::fromLatin1("__LINE__")).strictlyEquals(lineNumberFunction()))
- global.setProperty(QString::fromLatin1("__LINE__"), QScriptValue());
- d->agent->nullifyBackendPointer();
- d->agent = 0; // agent is owned by engine
+ if (d->agent) {
+ QScriptEngine *eng = d->agent->engine();
+ if (eng && eng->agent() == d->agent) {
+ eng->setAgent(0);
+ QScriptValue global = eng->globalObject();
+ if (global.property(QString::fromLatin1("print")).strictlyEquals(traceFunction()))
+ global.setProperty(QString::fromLatin1("print"), QScriptValue());
+// global.setProperty(QString::fromLatin1("qAssert"), QScriptValue());
+ if (global.property(QString::fromLatin1("__FILE__")).strictlyEquals(fileNameFunction()))
+ global.setProperty(QString::fromLatin1("__FILE__"), QScriptValue());
+ if (global.property(QString::fromLatin1("__LINE__")).strictlyEquals(lineNumberFunction()))
+ global.setProperty(QString::fromLatin1("__LINE__"), QScriptValue());
+ d->agent->nullifyBackendPointer();
+ d->agent = 0; // agent is owned by engine
+ }
}
d->pendingEvaluateLineNumber = -1;