diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-05-16 08:58:37 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-21 08:40:41 +0200 |
commit | 65500896a05344bdfd5fcbfa9a6456f48cd4e4a4 (patch) | |
tree | 4bbda8dbc6db22d48ef7e93b343effb941d76244 /src/qml/qml/qqmlboundsignal_p.h | |
parent | b2f9a9a48e805133f49ff0a4491a93f12f770dc0 (diff) |
Detect and abort if an object is deleted during signal handling
If an object gets deleted while one of its own signal handler
expressions is being evaluated, a subsequent crash is inevitable.
While we could introduce guards/checks in the signal handler kernel
(QMetaObject::activate(), QQmlNotifier::emitNotify() and friends) to
detect and mask the sender deletion, this arguably isn't helpful; the
code that emitted the signal is likely to access member variables
directly after emitting the signal, causing semi-random crashes.
This situation is a symptom of misbehaving application code. Catch it
early rather than later, and issue a qFatal() with a helpful message.
Coupled with a backtrace, this should make it easier to track down
the flawed C++ application logic.
Change-Id: I8c77800e49c475def613224f208181c2d0af60e6
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlboundsignal_p.h')
-rw-r--r-- | src/qml/qml/qqmlboundsignal_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h index f9159ee70f..e3ef65ed7f 100644 --- a/src/qml/qml/qqmlboundsignal_p.h +++ b/src/qml/qml/qqmlboundsignal_p.h @@ -118,6 +118,7 @@ public: virtual QQmlBoundSignalExpressionPointer setExpression(QQmlBoundSignalExpression *) = 0; virtual QQmlBoundSignalExpressionPointer takeExpression(QQmlBoundSignalExpression *) = 0; virtual QObject *scope() = 0; + virtual bool isEvaluating() const = 0; void removeFromObject(); protected: |