Skip to content
Permalink
Browse files

Trying to fix #10164 (crash on zoom in/out)

This happens due to infinite recursion when syncing extent between
map canvas and map renderer. Not entirely sure why, seems to happen
only on 32bit systems.
  • Loading branch information
wonder-sk committed Jun 4, 2014
1 parent 32ddb20 commit e6b337e32312772a3450e4b5bd6c9720c2a99dcb
Showing with 15 additions and 0 deletions.
  1. +13 −0 src/gui/qgsmapcanvas.cpp
  2. +2 −0 src/gui/qgsmapcanvas.h
@@ -89,6 +89,7 @@ QgsMapCanvasRendererSync::QgsMapCanvasRendererSync( QgsMapCanvas* canvas, QgsMap
: QObject( canvas )
, mCanvas( canvas )
, mRenderer( renderer )
, mSyncingExtent( false )
{
connect( mCanvas, SIGNAL( extentsChanged() ), this, SLOT( onExtentC2R() ) );
connect( mRenderer, SIGNAL( extentsChanged() ), this, SLOT( onExtentR2C() ) );
@@ -109,12 +110,24 @@ QgsMapCanvasRendererSync::QgsMapCanvasRendererSync( QgsMapCanvas* canvas, QgsMap

void QgsMapCanvasRendererSync::onExtentC2R()
{
// protection against possible bounce back
if ( mSyncingExtent )
return;

mSyncingExtent = true;
mRenderer->setExtent( mCanvas->mapSettings().extent() );
mSyncingExtent = false;
}

void QgsMapCanvasRendererSync::onExtentR2C()
{
// protection against possible bounce back
if ( mSyncingExtent )
return;

mSyncingExtent = true;
mCanvas->setExtent( mRenderer->extent() );
mSyncingExtent = false;
}

void QgsMapCanvasRendererSync::onMapUnitsC2R()
@@ -662,6 +662,8 @@ class QgsMapCanvasRendererSync : public QObject
protected:
QgsMapCanvas* mCanvas;
QgsMapRenderer* mRenderer;

bool mSyncingExtent;
};


0 comments on commit e6b337e

Please sign in to comment.
You can’t perform that action at this time.