summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-01-21 18:38:53 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-01-21 18:38:53 (GMT)
commit8e65adce9ced8f3b1d42b938e4d65e1af4768c33 (patch)
tree042094137a842b98a41474ce99192b67a822820c /src/script
parent613be7cd75663ab8227de80d75d8f01e92c5c7d2 (diff)
parent2ae6b44e4242c60bd882661e104bb53fa6670556 (diff)
downloadQt-8e65adce9ced8f3b1d42b938e4d65e1af4768c33.zip
Qt-8e65adce9ced8f3b1d42b938e4d65e1af4768c33.tar.gz
Qt-8e65adce9ced8f3b1d42b938e4d65e1af4768c33.tar.bz2
Merge branch '4.6'
Conflicts: tools/assistant/lib/qhelpsearchquerywidget.cpp
Diffstat (limited to 'src/script')
-rw-r--r--src/script/bridge/qscriptqobject.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index fb0dddb..db312bc 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();
@@ -2219,7 +2220,14 @@ void QObjectConnectionManager::execute(int slotIndex, void **argv)
JSC::call(exec, slot, callType, callData, thisObject, jscArgs);
if (exec->hadException()) {
- engine->emitSignalHandlerException();
+ if (slot.inherits(&QtFunction::info) && !static_cast<QtFunction*>(JSC::asObject(slot))->qobject()) {
+ // The function threw an error because the target QObject has been deleted.
+ // The connections list is stale; remove the signal handler and ignore the exception.
+ removeSignalHandler(sender(), signalIndex, receiver, slot);
+ exec->clearException();
+ } else {
+ engine->emitSignalHandlerException();
+ }
}
}