diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-08-12 06:56:24 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-08-12 06:56:24 (GMT) |
commit | bda5fd63ae9c1aa16492fad26dcabeffb8bd8db4 (patch) | |
tree | f38feacdedf19d1f8867de9e76199e4ea743acd0 /src | |
parent | 3906239fca832896ebdd85d4fc80e083b0c2b5ce (diff) | |
parent | d3599ab224f00915045562562c7fd4d6b9b9aeb4 (diff) | |
download | Qt-bda5fd63ae9c1aa16492fad26dcabeffb8bd8db4.zip Qt-bda5fd63ae9c1aa16492fad26dcabeffb8bd8db4.tar.gz Qt-bda5fd63ae9c1aa16492fad26dcabeffb8bd8db4.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-qml-staging:
Always disconnect signals on aborted reply objects
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 77fc7de..658dcad 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -537,6 +537,15 @@ public: emit q->statusChanged(status); } + void deleteReply() { + Q_Q(QDeclarativeXmlListModel); + if (reply) { + QObject::disconnect(reply, 0, q, 0); + reply->deleteLater(); + reply = 0; + } + } + bool isComponentComplete; QUrl src; QString xml; @@ -546,6 +555,7 @@ public: QList<int> roles; QStringList roleNames; int highestRole; + QNetworkReply *reply; QDeclarativeXmlListModel::Status status; QString errorString; @@ -553,6 +563,7 @@ public: int queryId; QStringList keyRoleResultsCache; QList<QDeclarativeXmlListModelRole *> roleObjects; + static void append_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list, QDeclarativeXmlListModelRole *role); static void clear_role(QDeclarativeListProperty<QDeclarativeXmlListModelRole> *list); QList<QList<QVariant> > data; @@ -994,11 +1005,7 @@ void QDeclarativeXmlListModel::reload() if (d->reply) { d->reply->abort(); - if (d->reply) { - // abort will generally have already done this (and more) - d->reply->deleteLater(); - d->reply = 0; - } + d->deleteReply(); } if (!d->xml.isEmpty()) { @@ -1032,8 +1039,7 @@ void QDeclarativeXmlListModel::requestFinished() QVariant redirect = d->reply->attribute(QNetworkRequest::RedirectionTargetAttribute); if (redirect.isValid()) { QUrl url = d->reply->url().resolved(redirect.toUrl()); - d->reply->deleteLater(); - d->reply = 0; + d->deleteReply(); setSource(url); return; } @@ -1042,9 +1048,7 @@ void QDeclarativeXmlListModel::requestFinished() if (d->reply->error() != QNetworkReply::NoError) { d->errorString = d->reply->errorString(); - disconnect(d->reply, 0, this, 0); - d->reply->deleteLater(); - d->reply = 0; + d->deleteReply(); int count = this->count(); d->data.clear(); @@ -1065,9 +1069,7 @@ void QDeclarativeXmlListModel::requestFinished() } else { d->queryId = QDeclarativeXmlQueryEngine::instance(qmlEngine(this))->doQuery(d->query, d->namespaces, data, &d->roleObjects, d->keyRoleResultsCache); } - disconnect(d->reply, 0, this, 0); - d->reply->deleteLater(); - d->reply = 0; + d->deleteReply(); d->progress = 1.0; emit progressChanged(d->progress); |