Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #3120 from manisandro/rendering_crash
Guard against possible crash by using destroyed QgsMapRendererCustomPainterJob
- Loading branch information
|
@@ -97,6 +97,14 @@ void QgsMapRendererCustomPainterJob::start() |
|
|
} |
|
|
|
|
|
mLayerJobs = prepareJobs( mPainter, mLabelingEngine, mLabelingEngineV2 ); |
|
|
// prepareJobs calls mapLayer->createMapRenderer may involve cloning a RasterDataProvider, |
|
|
// whose constructor may need to download some data (i.e. WMS, AMS) and doing so runs a |
|
|
// QEventLoop waiting for the network request to complete. If unluckily someone calls |
|
|
// mapCanvas->refresh() while this is happening, QgsMapRendererCustomPainterJob::cancel is |
|
|
// called, deleting the QgsMapRendererCustomPainterJob while this function is running. |
|
|
// Hence we need to check whether the job is still active before proceeding |
|
|
if ( !isActive() ) |
|
|
return; |
|
|
|
|
|
QgsDebugMsg( "Rendering prepared in (seconds): " + QString( "%1" ).arg( prepareTime.elapsed() / 1000.0 ) ); |
|
|
|
|
|
|
@@ -75,6 +75,14 @@ void QgsMapRendererParallelJob::start() |
|
|
} |
|
|
|
|
|
mLayerJobs = prepareJobs( nullptr, mLabelingEngine, mLabelingEngineV2 ); |
|
|
// prepareJobs calls mapLayer->createMapRenderer may involve cloning a RasterDataProvider, |
|
|
// whose constructor may need to download some data (i.e. WMS, AMS) and doing so runs a |
|
|
// QEventLoop waiting for the network request to complete. If unluckily someone calls |
|
|
// mapCanvas->refresh() while this is happening, QgsMapRendererCustomPainterJob::cancel is |
|
|
// called, deleting the QgsMapRendererCustomPainterJob while this function is running. |
|
|
// Hence we need to check whether the job is still active before proceeding |
|
|
if ( !isActive() ) |
|
|
return; |
|
|
|
|
|
QgsDebugMsg( QString( "QThreadPool max thread count is %1" ).arg( QThreadPool::globalInstance()->maxThreadCount() ) ); |
|
|
|
|
|