diff options
author | Aaron McCarthy <aaron.mccarthy@jollamobile.com> | 2014-02-05 18:28:00 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-05 12:54:47 +0100 |
commit | 57b8f6a38f121ad5cd7bf3dd911ef61cca7a0bfb (patch) | |
tree | 172b5945aafa4c5e081e90acfd9825533a2a0179 /src/location | |
parent | 9b78a26acd384ee9d2bb7895e60cd182110297bf (diff) | |
download | qtlocation-57b8f6a38f121ad5cd7bf3dd911ef61cca7a0bfb.tar.gz |
Attempt to crash in tile cache.
The tile cache can sometimes end up with null pointers which causes a
crash when saving the state of the cache queues to disk. Fixed by
skipping over these entries.
Task-number: QTBUG-36486
Change-Id: Ifa359bd1f9dbe37da0d5b208a7c4ee7a26f8bd44
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/location')
-rw-r--r-- | src/location/maps/qgeotilecache.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/location/maps/qgeotilecache.cpp b/src/location/maps/qgeotilecache.cpp index 8a86b7c4..54a850cd 100644 --- a/src/location/maps/qgeotilecache.cpp +++ b/src/location/maps/qgeotilecache.cpp @@ -196,11 +196,13 @@ QGeoTileCache::~QGeoTileCache() } QList<QSharedPointer<QGeoCachedTileDisk> > queue; diskCache_.serializeQueue(i, queue); - int queueLength = queue.size(); - for (int j = 0; j<queueLength; j++) { + foreach (const QSharedPointer<QGeoCachedTileDisk> &tile, queue) { + if (tile.isNull()) + continue; + // we just want the filename here, not the full path - int index = queue[j]->filename.lastIndexOf(QLatin1Char('/')); - QByteArray filename = queue[j]->filename.mid(index + 1).toLatin1() + '\n'; + int index = tile->filename.lastIndexOf(QLatin1Char('/')); + QByteArray filename = tile->filename.mid(index + 1).toLatin1() + '\n'; file.write(filename); } file.close(); |