Skip to content

Commit

Permalink
Merge pull request #46701 from m-kuhn/server_freeze
Browse files Browse the repository at this point in the history
Avoid deadlock in QGIS server
  • Loading branch information
m-kuhn committed Jan 20, 2022
2 parents 23e9e06 + 32b1947 commit 1c8f9d9
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 1c8f9d9

Please sign in to comment.