diff options
author | Thomas Lowe <thomas.lowe@nokia.com> | 2012-05-18 16:26:27 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-29 01:47:51 +0200 |
commit | c77d8c17c0264fd902aa0fcd54a435f6a9f216b0 (patch) | |
tree | 0375e7dc22ba6f89a91a0b07d1ee5cecaa387b06 /src/plugins | |
parent | 3ad2e9f5e14034f87700717c6ad1d52041088f8e (diff) | |
download | qtlocation-c77d8c17c0264fd902aa0fcd54a435f6a9f216b0.tar.gz |
Correct destruction of mappingManagerEngine
Use of weakPointer to prevent accessing deleted memory. Plus thread exiting to
cause the fetcher and thread to destroy themselves.
Additional use of weak pointers to deal with the complexity of the mapping manager
destructing before the declarative objects.
Task-number: QTBUG-25797
Change-Id: I6a27568580c1a00f7588565ff7e35d63eb5dd785
Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp | 14 | ||||
-rw-r--r-- | src/plugins/geoservices/nokia/qgeotilefetcher_nokia.h | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp b/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp index 3f407e64..f90b1c4a 100644 --- a/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp @@ -196,7 +196,7 @@ QString QGeoTileFetcherNokia::getRequestString(const QGeoTileSpec &spec) QString QGeoTileFetcherNokia::getLanguageString() const { - const QLocale::Language lang = m_engineNokia->locale().language(); + const QLocale::Language lang = m_engineNokia.data()->locale().language(); // English is the default, where no ln is specified. We hardcode the languages // here even though the entire list is updated automagically from the server. // The current languages are Arabic, Chinese, Simplified Chinese, English @@ -207,7 +207,7 @@ QString QGeoTileFetcherNokia::getLanguageString() const case QLocale::Arabic: return "ARA"; case QLocale::Chinese: - if (QLocale::TraditionalChineseScript == m_engineNokia->locale().script()) + if (QLocale::TraditionalChineseScript == m_engineNokia.data()->locale().script()) return "CHI"; else return "CHT"; @@ -241,10 +241,12 @@ QString QGeoTileFetcherNokia::applicationId() const void QGeoTileFetcherNokia::copyrightsFetched() { - QMetaObject::invokeMethod(m_engineNokia, - "loadCopyrightsDescriptorsFromJson", - Qt::QueuedConnection, - Q_ARG(QByteArray, m_copyrightsReply->readAll())); + if (m_engineNokia) { + QMetaObject::invokeMethod(m_engineNokia.data(), + "loadCopyrightsDescriptorsFromJson", + Qt::QueuedConnection, + Q_ARG(QByteArray, m_copyrightsReply->readAll())); + } } void QGeoTileFetcherNokia::fetchCopyrightsData() diff --git a/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.h b/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.h index 610dc147..eb5f02b7 100644 --- a/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.h +++ b/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.h @@ -93,7 +93,7 @@ private: QString getLanguageString() const; - QGeoTiledMappingManagerEngineNokia *m_engineNokia; + QWeakPointer<QGeoTiledMappingManagerEngineNokia> m_engineNokia; QGeoNetworkAccessManager *m_networkManager; QMap<QString, QVariant> m_parameters; QSize m_tileSize; |