diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-01-23 13:55:55 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2015-01-26 18:09:42 +0100 |
commit | d8d9c4fbb6047b59b98108d6e3221206aa926ccd (patch) | |
tree | b3e106b3e803b33804247b27f131e53c1d60dc12 | |
parent | 3a10cee763b98e13dc70e585ff59d0b8e48e60e0 (diff) | |
download | qtlocation-d8d9c4fbb6047b59b98108d6e3221206aa926ccd.tar.gz |
Don't reparent network replies away from their owning network manager
This can cause bad things to happen when the network manager owning
the replies gets deleted. The network manager destructor usually cleans
up it's own replies. When reparenting them away that won't happen, but
the replies might still have pending events and have pointers back
into the network manager.
Change-Id: I1d8330a198e9225a557d127f4a91247bcfa4812f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
6 files changed, 6 insertions, 28 deletions
diff --git a/src/plugins/geoservices/mapbox/qgeomapreplymapbox.cpp b/src/plugins/geoservices/mapbox/qgeomapreplymapbox.cpp index 7f080724..cbfa40a4 100644 --- a/src/plugins/geoservices/mapbox/qgeomapreplymapbox.cpp +++ b/src/plugins/geoservices/mapbox/qgeomapreplymapbox.cpp @@ -41,7 +41,6 @@ QGeoMapReplyMapbox::QGeoMapReplyMapbox(QNetworkReply *reply, const QGeoTileSpec connect(m_reply, SIGNAL(finished()), this, SLOT(networkReplyFinished())); connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(networkReplyError(QNetworkReply::NetworkError))); - connect(m_reply, SIGNAL(destroyed()), this, SLOT(replyDestroyed())); } QGeoMapReplyMapbox::~QGeoMapReplyMapbox() @@ -65,11 +64,6 @@ QNetworkReply *QGeoMapReplyMapbox::networkReply() const return m_reply; } -void QGeoMapReplyMapbox::replyDestroyed() -{ - m_reply = 0; -} - void QGeoMapReplyMapbox::networkReplyFinished() { if (!m_reply) diff --git a/src/plugins/geoservices/mapbox/qgeomapreplymapbox.h b/src/plugins/geoservices/mapbox/qgeomapreplymapbox.h index ca4ec687..3a42a7b1 100644 --- a/src/plugins/geoservices/mapbox/qgeomapreplymapbox.h +++ b/src/plugins/geoservices/mapbox/qgeomapreplymapbox.h @@ -36,6 +36,7 @@ #include <QtNetwork/QNetworkReply> #include <QtLocation/private/qgeotiledmapreply_p.h> +#include <QtCore/QPointer> QT_BEGIN_NAMESPACE @@ -52,12 +53,11 @@ public: QNetworkReply *networkReply() const; private Q_SLOTS: - void replyDestroyed(); void networkReplyFinished(); void networkReplyError(QNetworkReply::NetworkError error); private: - QNetworkReply *m_reply; + QPointer<QNetworkReply> m_reply; QString m_format; }; diff --git a/src/plugins/geoservices/nokia/qgeomapreply_nokia.cpp b/src/plugins/geoservices/nokia/qgeomapreply_nokia.cpp index 865396ba..ec9b18fb 100644 --- a/src/plugins/geoservices/nokia/qgeomapreply_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeomapreply_nokia.cpp @@ -49,7 +49,6 @@ QGeoMapReplyNokia::QGeoMapReplyNokia(QNetworkReply *reply, const QGeoTileSpec &s : QGeoTiledMapReply(spec, parent), m_reply(reply) { - m_reply->setParent(this); connect(m_reply, SIGNAL(finished()), this, @@ -59,11 +58,6 @@ QGeoMapReplyNokia::QGeoMapReplyNokia(QNetworkReply *reply, const QGeoTileSpec &s SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(networkError(QNetworkReply::NetworkError))); - - connect(m_reply, - SIGNAL(destroyed()), - this, - SLOT(replyDestroyed())); } QGeoMapReplyNokia::~QGeoMapReplyNokia() @@ -83,11 +77,6 @@ void QGeoMapReplyNokia::abort() m_reply->abort(); } -void QGeoMapReplyNokia::replyDestroyed() -{ - m_reply = 0; -} - void QGeoMapReplyNokia::networkFinished() { if (!m_reply) diff --git a/src/plugins/geoservices/nokia/qgeomapreply_nokia.h b/src/plugins/geoservices/nokia/qgeomapreply_nokia.h index c1c8e245..526bccb0 100644 --- a/src/plugins/geoservices/nokia/qgeomapreply_nokia.h +++ b/src/plugins/geoservices/nokia/qgeomapreply_nokia.h @@ -44,6 +44,7 @@ #include <QtNetwork/QNetworkReply> #include <QtLocation/private/qgeotilespec_p.h> #include <QtLocation/private/qgeotiledmapreply_p.h> +#include <QtCore/QPointer> QT_BEGIN_NAMESPACE @@ -60,12 +61,11 @@ public: QNetworkReply *networkReply() const; private Q_SLOTS: - void replyDestroyed(); void networkFinished(); void networkError(QNetworkReply::NetworkError error); private: - QNetworkReply *m_reply; + QPointer<QNetworkReply> m_reply; }; QT_END_NAMESPACE diff --git a/src/plugins/geoservices/osm/qgeomapreplyosm.cpp b/src/plugins/geoservices/osm/qgeomapreplyosm.cpp index 2970641d..b0c06f22 100644 --- a/src/plugins/geoservices/osm/qgeomapreplyosm.cpp +++ b/src/plugins/geoservices/osm/qgeomapreplyosm.cpp @@ -65,11 +65,6 @@ QNetworkReply *QGeoMapReplyOsm::networkReply() const return m_reply; } -void QGeoMapReplyOsm::replyDestroyed() -{ - m_reply = 0; -} - void QGeoMapReplyOsm::networkReplyFinished() { if (!m_reply) diff --git a/src/plugins/geoservices/osm/qgeomapreplyosm.h b/src/plugins/geoservices/osm/qgeomapreplyosm.h index 1672258d..1795ffa9 100644 --- a/src/plugins/geoservices/osm/qgeomapreplyosm.h +++ b/src/plugins/geoservices/osm/qgeomapreplyosm.h @@ -36,6 +36,7 @@ #include <QtNetwork/QNetworkReply> #include <QtLocation/private/qgeotiledmapreply_p.h> +#include <QtCore/qpointer.h> QT_BEGIN_NAMESPACE @@ -52,12 +53,11 @@ public: QNetworkReply *networkReply() const; private Q_SLOTS: - void replyDestroyed(); void networkReplyFinished(); void networkReplyError(QNetworkReply::NetworkError error); private: - QNetworkReply *m_reply; + QPointer<QNetworkReply> m_reply; }; QT_END_NAMESPACE |