diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2016-09-14 16:28:38 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2016-11-29 10:52:47 +0000 |
commit | 0a552f285fdc3760d9755109ceef3b87392a308d (patch) | |
tree | 943e169f0c002d8e9f74badd0f3ad7a452229e4d /src/location/places | |
parent | 9b76e151b897698e285e4e39158b5934dc498bd1 (diff) | |
download | qtlocation-0a552f285fdc3760d9755109ceef3b87392a308d.tar.gz |
Refactoring: removing m_reply from GeoReply classes
This patch tries to simplify the code removing the contained m_reply
from all the Geo[Map,Route,Geocode,Places]Reply classes.
The need for m_reply was associated to the "abort" method, but this
can be solved by emitting a signal in the superclass abort() method,
and connecting that to QNetworkReply::abort() in the constructor.
Since QNetworkReplyHttpImpl always sends an OperationCanceledError
it should then be safe to call deleteLater() on the network reply
in the slot connected to QNetworkReply::error
This patch also prevents the series of
"QCoreApplication::postEvent: Unexpected null receiver" warnings
that are generated due to deletingLater already deleted objects
(abort() emits an error, the reply is destroyed inside the
onError slot, but also in the abort() method).
Finally, this patch removes the setFinished() call in
QGeoRouteReply::abort() since the documentation does not mention
this, and all the subclasses do not perform this operation and
emit the corresponding signal.
tst_qgeoroutereply has been adapted accordingly.
Change-Id: I226ee163e7bed784dd7f0da1522e651459543bca
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/location/places')
-rw-r--r-- | src/location/places/qplacereply.cpp | 1 | ||||
-rw-r--r-- | src/location/places/qplacereply.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/location/places/qplacereply.cpp b/src/location/places/qplacereply.cpp index 0590871d..582987b4 100644 --- a/src/location/places/qplacereply.cpp +++ b/src/location/places/qplacereply.cpp @@ -199,6 +199,7 @@ QPlaceReply::Error QPlaceReply::error() const */ void QPlaceReply::abort() { + emit aborted(); } /*! diff --git a/src/location/places/qplacereply.h b/src/location/places/qplacereply.h index 374c68b3..3eb3d6cc 100644 --- a/src/location/places/qplacereply.h +++ b/src/location/places/qplacereply.h @@ -86,6 +86,7 @@ public Q_SLOTS: Q_SIGNALS: void finished(); + void aborted(); void error(QPlaceReply::Error error, const QString &errorString = QString()); protected: |