aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-03-12 09:31:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-12 15:10:04 +0100
commitf844c588fc1e34e6269ba9636c2cb2706e94457b (patch)
tree5d3804108dac6508898218b4ae085d8d03da63cb /src/qml/jsruntime
parent9cc72b43e09c5abd94bb8d13e5b3fbe4d674a726 (diff)
Don't crash when a signal/slot connection outlives the engine
In the test case in the bug, the signal was emitted from the QApplication destructor (somewhere from the qpa plugin when the platform windows were destroyed) Task-number: QTBUG-37351 Change-Id: Ieec59e12be10bab1428743b80eecdf22ef9d8bf6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 004c3eb036..1cfd2d88ec 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -751,13 +751,18 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
break;
case Call: {
QObjectSlotDispatcher *This = static_cast<QObjectSlotDispatcher*>(this_);
+ QV4::ExecutionEngine *v4 = This->function.engine();
+ // Might be that we're still connected to a signal that's emitted long
+ // after the engine died. We don't track connections in a global list, so
+ // we need this safeguard.
+ if (!v4)
+ break;
+
QVarLengthArray<int, 9> dummy;
int *argsTypes = QQmlPropertyCache::methodParameterTypes(r, This->signalIndex, dummy, 0);
int argCount = argsTypes ? argsTypes[0]:0;
- QV4::ExecutionEngine *v4 = This->function.engine();
- Q_ASSERT(v4);
QV4::Scope scope(v4);
QV4::ScopedFunctionObject f(scope, This->function.value());
QV4::ExecutionContext *ctx = v4->currentContext();