Skip to content

Commit

Permalink
Fix rare crash on map canvas deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Mar 29, 2017
1 parent 1c202e7 commit 55d0ad7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -198,6 +198,14 @@ QgsMapCanvas::~QgsMapCanvas()
}
mLastNonZoomMapTool = nullptr;

// rendering job may still end up writing into canvas map item
// so kill it before deleting canvas items
if ( mJob )
{
whileBlocking( mJob )->cancel();
Q_ASSERT( !mJob );
}

// delete canvas items prior to deleting the canvas
// because they might try to update canvas when it's
// already being destructed, ends with segfault
Expand All @@ -215,12 +223,6 @@ QgsMapCanvas::~QgsMapCanvas()
// mCanvasProperties auto-deleted via QScopedPointer
// CanvasProperties struct has its own dtor for freeing resources

if ( mJob )
{
whileBlocking( mJob )->cancel();
delete mJob;
}

delete mCache;

delete mLabelingResults;
Expand Down

0 comments on commit 55d0ad7

Please sign in to comment.