Skip to content

Commit 55d0ad7

Browse files
committedMar 29, 2017
Fix rare crash on map canvas deletion
1 parent 1c202e7 commit 55d0ad7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed
 

‎src/gui/qgsmapcanvas.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ QgsMapCanvas::~QgsMapCanvas()
198198
}
199199
mLastNonZoomMapTool = nullptr;
200200

201+
// rendering job may still end up writing into canvas map item
202+
// so kill it before deleting canvas items
203+
if ( mJob )
204+
{
205+
whileBlocking( mJob )->cancel();
206+
Q_ASSERT( !mJob );
207+
}
208+
201209
// delete canvas items prior to deleting the canvas
202210
// because they might try to update canvas when it's
203211
// already being destructed, ends with segfault
@@ -215,12 +223,6 @@ QgsMapCanvas::~QgsMapCanvas()
215223
// mCanvasProperties auto-deleted via QScopedPointer
216224
// CanvasProperties struct has its own dtor for freeing resources
217225

218-
if ( mJob )
219-
{
220-
whileBlocking( mJob )->cancel();
221-
delete mJob;
222-
}
223-
224226
delete mCache;
225227

226228
delete mLabelingResults;

0 commit comments

Comments
 (0)
Please sign in to comment.