diff --git a/app/map/inputmapcanvasmap.cpp b/app/map/inputmapcanvasmap.cpp index 6817f6e1c..e5a62b8ae 100644 --- a/app/map/inputmapcanvasmap.cpp +++ b/app/map/inputmapcanvasmap.cpp @@ -55,7 +55,10 @@ InputMapCanvasMap::InputMapCanvasMap( QQuickItem *parent ) setFlags( QQuickItem::ItemHasContents ); } -InputMapCanvasMap::~InputMapCanvasMap() = default; +InputMapCanvasMap::~InputMapCanvasMap() +{ + stopRendering(); +} InputMapSettings *InputMapCanvasMap::mapSettings() const { @@ -438,9 +441,16 @@ void InputMapCanvasMap::stopRendering() { if ( mJob ) { + mMapUpdateTimer.stop(); + disconnect( mJob, &QgsMapRendererJob::renderingLayersFinished, this, &InputMapCanvasMap::renderJobUpdated ); disconnect( mJob, &QgsMapRendererJob::finished, this, &InputMapCanvasMap::renderJobFinished ); + if ( !mJob->isActive() ) + mJob->deleteLater(); + else + connect( mJob, &QgsMapRendererJob::finished, mJob, &QObject::deleteLater ); + mJob->cancelWithoutBlocking(); mJob = nullptr; }