From 18a5a096c9020c7b1b10b82009c912b4b97335a3 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 15 Jan 2010 10:44:58 +1000 Subject: QmlGuard the list of objects in a Package. Don't crash if those objects are deleted before the Package. --- src/declarative/util/qmlpackage.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp index f9238ca..3214dc8 100644 --- a/src/declarative/util/qmlpackage.cpp +++ b/src/declarative/util/qmlpackage.cpp @@ -42,6 +42,7 @@ #include "qmlpackage_p.h" #include +#include "private/qmlguard_p.h" QT_BEGIN_NAMESPACE @@ -50,7 +51,28 @@ class QmlPackagePrivate : public QObjectPrivate public: QmlPackagePrivate() {} - QmlConcreteList dataList; + class DataList; + struct DataGuard : public QmlGuard + { + DataGuard(QObject *obj, DataList *l) : list(l) { (QmlGuard&)*this = obj; } + DataList *list; + void objectDestroyed(QObject *) { + // we assume priv will always be destroyed after objectDestroyed calls + list->removeOne(*this); + } + }; + + class DataList : public QList, public QmlList + { + public: + virtual void append(QObject* v) { QList::append(DataGuard(v, this)); } + virtual void insert(int i, QObject* v) { QList::insert(i, DataGuard(v, this)); } + virtual void clear() { QList::clear(); } + virtual QObject* at(int i) const { return QList::at(i); } + virtual void removeAt(int i) { QList::removeAt(i); } + virtual int count() const { return QList::count(); } + }; + DataList dataList; }; class QmlPackageAttached : public QObject -- cgit v0.12 From c9dcaed1d6eef6a15cc8266cff68636487aa3352 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 15 Jan 2010 11:53:13 +1000 Subject: Doc fixes. Task-number: QTBUG-7322 --- doc/src/declarative/extending.qdoc | 2 +- tools/qdoc3/test/qt-build-docs.qdocconf | 2 +- tools/qdoc3/test/qt.qdocconf | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 84d7089..893838f 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -296,7 +296,7 @@ identified through the use of the attacher type name, in the case shown \c BirthdayParty, as a suffix to the property name. In the example shown, \c BirthdayParty is called the attaching type, and the -Box instance the attachee object instance. +Boy instance the attachee object instance. For the attaching type, an attached property block is implemented as a new QObject derived type, called the attachment object. The properties on the diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index 09dd979..20f90e6 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -96,7 +96,7 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ $QT_SOURCE_TREE/src/3rdparty/phonon/waveout sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" +examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" examples.imageextensions = "*.png" exampledirs = $QT_SOURCE_TREE/doc/src \ diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index 6d25432..6fbfe3f 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -99,7 +99,7 @@ excludedirs = $QTDIR/src/3rdparty/clucene \ $QTDIR/src/3rdparty/phonon/waveout sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" +examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" examples.imageextensions = "*.png" exampledirs = $QTDIR/doc/src \ @@ -110,7 +110,7 @@ exampledirs = $QTDIR/doc/src \ $QTDIR/src/3rdparty/webkit/WebKit/qt/docs imagedirs = $QTDIR/doc/src/images \ $QTDIR/examples \ - $QTDIR/doc/src/declarative/pics + $QTDIR/doc/src/declarative/pics outputdir = $QTDIR/doc/html tagfile = $QTDIR/doc/html/qt.tags base = file:$QTDIR/doc/html -- cgit v0.12 From d45e7d09675f5dca5d18e2810c8cd8ae6b023279 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 15 Jan 2010 13:33:14 +1000 Subject: Explicit animations in a transition should mark the property as modified. --- src/declarative/util/qmlanimation.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 4c5015d..f5333a6 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -1032,15 +1032,26 @@ void QmlPropertyAction::transition(QmlStateActions &actions, QmlSetPropertyAnimationAction *data = new QmlSetPropertyAnimationAction; + bool hasExplicit = false; if (hasTarget && d->value.isValid()) { Action myAction; myAction.property = d->createProperty(target(), d->propertyName, this); if (myAction.property.isValid()) { myAction.toValue = d->value; data->actions << myAction; + hasExplicit = true; + for (int ii = 0; ii < actions.count(); ++ii) { + Action &action = actions[ii]; + if (action.property.object() == myAction.property.object() && + myAction.property.name() == action.property.name()) { + modified << action.property; + break; //### any chance there could be multiples? + } + } } } + if (!hasExplicit) for (int ii = 0; ii < actions.count(); ++ii) { Action &action = actions[ii]; @@ -2219,6 +2230,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, data->interpolator = d->interpolator; data->reverse = direction == Backward ? true : false; + bool hasExplicit = false; //an explicit animation has been specified if (hasTarget && d->toIsDefined) { Action myAction; @@ -2231,9 +2243,19 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, d->convertVariant(d->to, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType()); myAction.toValue = d->to; data->actions << myAction; + hasExplicit = true; + for (int ii = 0; ii < actions.count(); ++ii) { + Action &action = actions[ii]; + if (action.property.object() == myAction.property.object() && + myAction.property.name() == action.property.name()) { + modified << action.property; + break; //### any chance there could be multiples? + } + } } } + if (!hasExplicit) for (int ii = 0; ii < actions.count(); ++ii) { Action &action = actions[ii]; -- cgit v0.12