summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qdeclarativestate.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-11-02 00:41:25 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-11-02 00:41:25 (GMT)
commit155065cd5c611e2d14357a8ff3180ac14a68e3a0 (patch)
tree2d5717696a035e107ecd28e097726170f9ffd387 /src/declarative/util/qdeclarativestate.cpp
parentd194ebdc199fdd85245bfecb766d836dfa79c3f3 (diff)
downloadQt-155065cd5c611e2d14357a8ff3180ac14a68e3a0.zip
Qt-155065cd5c611e2d14357a8ff3180ac14a68e3a0.tar.gz
Qt-155065cd5c611e2d14357a8ff3180ac14a68e3a0.tar.bz2
Removing a binding while it is being applied caused a crash.
Use a weak pointer to the binding in case applying the binding (while fast forwarding) causes it to be removed. Task-number: QTBUG-14830 Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative/util/qdeclarativestate.cpp')
-rw-r--r--src/declarative/util/qdeclarativestate.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index 0f5413e..3915485 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG);
QDeclarativeAction::QDeclarativeAction()
-: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), toBinding(0), event(0),
+: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), event(0),
specifiedObject(0)
{
}
@@ -67,7 +67,7 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN
const QVariant &value)
: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false),
property(target, propertyName), toValue(value),
- fromBinding(0), toBinding(0), event(0),
+ fromBinding(0), event(0),
specifiedObject(target), specifiedProperty(propertyName)
{
if (property.isValid())
@@ -78,7 +78,7 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN
QDeclarativeContext *context, const QVariant &value)
: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false),
property(target, propertyName, context), toValue(value),
- fromBinding(0), toBinding(0), event(0),
+ fromBinding(0), event(0),
specifiedObject(target), specifiedProperty(propertyName)
{
if (property.isValid())
@@ -503,11 +503,11 @@ void QDeclarativeState::addEntriesToRevertList(const QList<QDeclarativeAction> &
const QDeclarativeAction &action = actionListIterator.next();
QDeclarativeSimpleAction simpleAction(action);
action.property.write(action.toValue);
- if (action.toBinding) {
+ if (!action.toBinding.isNull()) {
QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::binding(simpleAction.property());
if (oldBinding)
QDeclarativePropertyPrivate::setBinding(simpleAction.property(), 0);
- QDeclarativePropertyPrivate::setBinding(simpleAction.property(), action.toBinding, QDeclarativePropertyPrivate::DontRemoveBinding);
+ QDeclarativePropertyPrivate::setBinding(simpleAction.property(), action.toBinding.data(), QDeclarativePropertyPrivate::DontRemoveBinding);
}
simpleActionList.append(simpleAction);
@@ -675,7 +675,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit
a.property = d->revertList.at(ii).property();
a.fromValue = cur;
a.toValue = d->revertList.at(ii).value();
- a.toBinding = d->revertList.at(ii).binding();
+ a.toBinding = QDeclarativeAbstractBinding::getPointer(d->revertList.at(ii).binding());
a.specifiedObject = d->revertList.at(ii).specifiedObject();
a.specifiedProperty = d->revertList.at(ii).specifiedProperty();
a.event = d->revertList.at(ii).event();