Skip to content

Commit 1b9f41d

Browse files
committed
Insure canvas rendering jobs are cancelled when exiting QGIS
1 parent 282a999 commit 1b9f41d

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/app/qgisapp.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,8 +1362,6 @@ QgisApp::QgisApp()
13621362

13631363
QgisApp::~QgisApp()
13641364
{
1365-
stopRendering();
1366-
13671365
delete mInternalClipboard;
13681366
delete mQgisInterface;
13691367
delete mStyleSheetBuilder;
@@ -1452,6 +1450,12 @@ QgisApp::~QgisApp()
14521450
qDeleteAll( mCustomDropHandlers );
14531451
qDeleteAll( mCustomLayoutDropHandlers );
14541452

1453+
const QList<QgsMapCanvas *> canvases = mapCanvases();
1454+
for ( QgsMapCanvas *canvas : canvases )
1455+
{
1456+
delete canvas;
1457+
}
1458+
14551459
// This function *MUST* be the last one called, as it destroys in
14561460
// particular GDAL. As above objects can hold GDAL/OGR objects, it is not
14571461
// safe destroying them afterwards

src/gui/qgsmapcanvas.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,16 @@ QgsMapCanvas::~QgsMapCanvas()
211211
delete mJob;
212212
}
213213

214+
QList< QgsMapRendererQImageJob * >::const_iterator previewJob = mPreviewJobs.constBegin();
215+
for ( ; previewJob != mPreviewJobs.constEnd(); ++previewJob )
216+
{
217+
if ( *previewJob )
218+
{
219+
whileBlocking( *previewJob )->cancel();
220+
delete *previewJob;
221+
}
222+
}
223+
214224
// delete canvas items prior to deleting the canvas
215225
// because they might try to update canvas when it's
216226
// already being destructed, ends with segfault

0 commit comments

Comments
 (0)