Skip to content

Commit

Permalink
Avoid deadlock in QGIS server
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored and github-actions[bot] committed Jan 20, 2022
1 parent eaa6680 commit fc20a1f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/server/services/wms/qgsmaprendererjobproxy.cpp
Expand Up @@ -56,17 +56,20 @@ namespace QgsWms
#ifdef HAVE_SERVER_PYTHON_PLUGINS
renderJob.setFeatureFilterProvider( mFeatureFilterProvider );
#endif
renderJob.start();

// Allows the main thread to manage blocking call coming from rendering
// threads (see discussion in https://github.com/qgis/QGIS/issues/26819).
QEventLoop loop;
QObject::connect( &renderJob, &QgsMapRendererParallelJob::finished, &loop, &QEventLoop::quit );
loop.exec();
renderJob.start();
if ( renderJob.isActive() )
{
loop.exec();

renderJob.waitForFinished();
*image = renderJob.renderedImage();
mPainter.reset( new QPainter( image ) );
renderJob.waitForFinished();
*image = renderJob.renderedImage();
mPainter.reset( new QPainter( image ) );
}

mErrors = renderJob.errors();
}
Expand Down

0 comments on commit fc20a1f

Please sign in to comment.