Skip to content

Commit 66a213b

Browse files
committed
Fix crash when loading WCS layers (fixes #15595)
The problem is that some providers would still issue network requests in prepareJobs() - this should be ideally avoided, because it is run in main thread - all the work should be deferred to be done in worker thread. (cherry picked from commit 08f4a0f)
1 parent f365206 commit 66a213b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/gui/qgsmapcanvas.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,9 +663,6 @@ void QgsMapCanvas::refreshMap()
663663

664664
stopRendering(); // if any...
665665

666-
// from now on we can accept refresh requests again
667-
mRefreshScheduled = false;
668-
669666
//build the expression context
670667
QgsExpressionContext expressionContext;
671668
expressionContext << QgsExpressionContextUtils::globalScope()
@@ -698,6 +695,14 @@ void QgsMapCanvas::refreshMap()
698695

699696
mJob->start();
700697

698+
// from now on we can accept refresh requests again
699+
// this must be reset only after the job has been started, because
700+
// some providers (yes, it's you WCS and AMS!) during preparation
701+
// do network requests and start an internal event loop, which may
702+
// end up calling refresh() and would schedule another refresh,
703+
// deleting the one we have just started.
704+
mRefreshScheduled = false;
705+
701706
mMapUpdateTimer.start();
702707

703708
emit renderStarting();

0 commit comments

Comments
 (0)