Skip to content
Permalink
Browse files

Insure canvas rendering jobs are cancelled when exiting QGIS

  • Loading branch information
nirvn committed Apr 4, 2018
1 parent d48818b commit 634274eeb51fe1901fd1b50c2fee1be68b625f2f
Showing with 16 additions and 2 deletions.
  1. +6 −2 src/app/qgisapp.cpp
  2. +10 −0 src/gui/qgsmapcanvas.cpp
@@ -1326,8 +1326,6 @@ QgisApp::QgisApp()

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

delete mInternalClipboard;
delete mQgisInterface;
delete mStyleSheetBuilder;
@@ -1416,6 +1414,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
@@ -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

0 comments on commit 634274e

Please sign in to comment.
You can’t perform that action at this time.