diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2010-01-18 13:56:22 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2010-01-18 14:06:47 (GMT) |
commit | 2f6459ff25a59e913b5695dcd8919ead8d58947c (patch) | |
tree | 0706b81b7ab9a5de17cf932001fe3bd031faf3dd /src/script | |
parent | 5346edef00dd8f541f16217e0960fd6bb4ea0981 (diff) | |
download | Qt-2f6459ff25a59e913b5695dcd8919ead8d58947c.zip Qt-2f6459ff25a59e913b5695dcd8919ead8d58947c.tar.gz Qt-2f6459ff25a59e913b5695dcd8919ead8d58947c.tar.bz2 |
don't assert when calling QtScript-wrapped method of deleted QObject
Make it behave the same as the old (4.5) back-end.
Reviewed-by: Jedrzej Nowacki
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/bridge/qscriptqobject.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp index fb0dddb..3f4f6bb 100644 --- a/src/script/bridge/qscriptqobject.cpp +++ b/src/script/bridge/qscriptqobject.cpp @@ -978,7 +978,8 @@ JSC::JSValue QtFunction::execute(JSC::ExecState *exec, JSC::JSValue thisValue, QScriptObjectDelegate *delegate = scriptObject->delegate(); Q_ASSERT(delegate && (delegate->type() == QScriptObjectDelegate::QtObject)); QObject *qobj = static_cast<QScript::QObjectDelegate*>(delegate)->value(); - Q_ASSERT_X(qobj != 0, "QtFunction::call", "handle the case when QObject has been deleted"); + if (!qobj) + return JSC::throwError(exec, JSC::GeneralError, QString::fromLatin1("cannot call function of deleted QObject")); QScriptEnginePrivate *engine = scriptEngineFromExec(exec); const QMetaObject *meta = qobj->metaObject(); |