summaryrefslogtreecommitdiffstats
path: root/src/corelib/statemachine/qstate_p.h
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-07-02 20:45:49 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-10 06:20:07 +0200
commitba87568655dad3e830e692109b5e571ae78b71a0 (patch)
treec9fb40d7ebdd75d8787794b6ae31f7b7f0ab610f /src/corelib/statemachine/qstate_p.h
parent482205d847a15e2afc7988c1792aaeb37e71505f (diff)
statemachine: Don't crash if property assignment target is deleted
Do like QPropertyAnimation and store the QObject in a QPointer. Purge the assignments list upon state entry and property restore. Change-Id: I54a56885a2905178ab6aa5cf292b3d25c86b7a97 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/corelib/statemachine/qstate_p.h')
-rw-r--r--src/corelib/statemachine/qstate_p.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h
index 30be47cf51..9558bd88a5 100644
--- a/src/corelib/statemachine/qstate_p.h
+++ b/src/corelib/statemachine/qstate_p.h
@@ -57,6 +57,7 @@
#include <QtCore/qlist.h>
#include <QtCore/qbytearray.h>
+#include <QtCore/qpointer.h>
#include <QtCore/qvariant.h>
QT_BEGIN_NAMESPACE
@@ -69,7 +70,10 @@ struct QPropertyAssignment
const QVariant &v, bool es = true)
: object(o), propertyName(n), value(v), explicitlySet(es)
{}
- QObject *object;
+
+ bool objectDeleted() const { return !object; }
+
+ QPointer<QObject> object;
QByteArray propertyName;
QVariant value;
bool explicitlySet;