Skip to content

Commit

Permalink
Insure canvas rendering jobs are cancelled when exiting QGIS
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Apr 4, 2018
1 parent 282a999 commit 1b9f41d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -1362,8 +1362,6 @@ QgisApp::QgisApp()

QgisApp::~QgisApp()
{
stopRendering();

delete mInternalClipboard;
delete mQgisInterface;
delete mStyleSheetBuilder;
Expand Down Expand Up @@ -1452,6 +1450,12 @@ QgisApp::~QgisApp()
qDeleteAll( mCustomDropHandlers );
qDeleteAll( mCustomLayoutDropHandlers );

const QList<QgsMapCanvas *> canvases = mapCanvases();
for ( QgsMapCanvas *canvas : canvases )
{
delete canvas;
}

// This function *MUST* be the last one called, as it destroys in
// particular GDAL. As above objects can hold GDAL/OGR objects, it is not
// safe destroying them afterwards
Expand Down
10 changes: 10 additions & 0 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -211,6 +211,16 @@ QgsMapCanvas::~QgsMapCanvas()
delete mJob;
}

QList< QgsMapRendererQImageJob * >::const_iterator previewJob = mPreviewJobs.constBegin();
for ( ; previewJob != mPreviewJobs.constEnd(); ++previewJob )
{
if ( *previewJob )
{
whileBlocking( *previewJob )->cancel();
delete *previewJob;
}
}

// 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 Down

0 comments on commit 1b9f41d

Please sign in to comment.