Skip to content

Commit

Permalink
Fix crash when loading WCS layers (fixes #15595)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
wonder-sk committed Oct 28, 2016
1 parent f365206 commit 66a213b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -663,9 +663,6 @@ void QgsMapCanvas::refreshMap()

stopRendering(); // if any...

// from now on we can accept refresh requests again
mRefreshScheduled = false;

//build the expression context
QgsExpressionContext expressionContext;
expressionContext << QgsExpressionContextUtils::globalScope()
Expand Down Expand Up @@ -698,6 +695,14 @@ void QgsMapCanvas::refreshMap()

mJob->start();

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

mMapUpdateTimer.start();

emit renderStarting();
Expand Down

0 comments on commit 66a213b

Please sign in to comment.