mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-19 04:02:09 +01:00
Fixed crash on ENC map unload
This commit is contained in:
parent
af688314fb
commit
9d8c23bc32
@ -30,6 +30,7 @@ void ENCMap::load()
|
|||||||
|
|
||||||
void ENCMap::unload()
|
void ENCMap::unload()
|
||||||
{
|
{
|
||||||
|
cancelJobs(true);
|
||||||
_data.clear();
|
_data.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ int ENCMap::zoomFit(const QSize &size, const RectC &rect)
|
|||||||
|
|
||||||
int ENCMap::zoomIn()
|
int ENCMap::zoomIn()
|
||||||
{
|
{
|
||||||
cancelJobs();
|
cancelJobs(false);
|
||||||
|
|
||||||
_zoom = qMin(_zoom + 1, ZOOMS.max());
|
_zoom = qMin(_zoom + 1, ZOOMS.max());
|
||||||
updateTransform();
|
updateTransform();
|
||||||
@ -65,7 +66,7 @@ int ENCMap::zoomIn()
|
|||||||
|
|
||||||
int ENCMap::zoomOut()
|
int ENCMap::zoomOut()
|
||||||
{
|
{
|
||||||
cancelJobs();
|
cancelJobs(false);
|
||||||
|
|
||||||
_zoom = qMax(_zoom - 1, ZOOMS.min());
|
_zoom = qMax(_zoom - 1, ZOOMS.min());
|
||||||
updateTransform();
|
updateTransform();
|
||||||
@ -141,10 +142,10 @@ void ENCMap::jobFinished(ENCMapJob *job)
|
|||||||
emit tilesLoaded();
|
emit tilesLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ENCMap::cancelJobs()
|
void ENCMap::cancelJobs(bool wait)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _jobs.size(); i++)
|
for (int i = 0; i < _jobs.size(); i++)
|
||||||
_jobs.at(i)->cancel();
|
_jobs.at(i)->cancel(wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ENCMap::key(int zoom, const QPoint &xy) const
|
QString ENCMap::key(int zoom, const QPoint &xy) const
|
||||||
|
@ -23,7 +23,12 @@ public:
|
|||||||
_future = QtConcurrent::map(_tiles, &ENC::RasterTile::render);
|
_future = QtConcurrent::map(_tiles, &ENC::RasterTile::render);
|
||||||
_watcher.setFuture(_future);
|
_watcher.setFuture(_future);
|
||||||
}
|
}
|
||||||
void cancel() {_future.cancel();}
|
void cancel(bool wait)
|
||||||
|
{
|
||||||
|
_future.cancel();
|
||||||
|
if (wait)
|
||||||
|
_future.waitForFinished();
|
||||||
|
}
|
||||||
const QList<ENC::RasterTile> &tiles() const {return _tiles;}
|
const QList<ENC::RasterTile> &tiles() const {return _tiles;}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -82,7 +87,7 @@ private:
|
|||||||
bool isRunning(int zoom, const QPoint &xy) const;
|
bool isRunning(int zoom, const QPoint &xy) const;
|
||||||
void runJob(ENCMapJob *job);
|
void runJob(ENCMapJob *job);
|
||||||
void removeJob(ENCMapJob *job);
|
void removeJob(ENCMapJob *job);
|
||||||
void cancelJobs();
|
void cancelJobs(bool wait);
|
||||||
QString key(int zoom, const QPoint &xy) const;
|
QString key(int zoom, const QPoint &xy) const;
|
||||||
|
|
||||||
ENC::MapData _data;
|
ENC::MapData _data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user