Skip to content

Commit

Permalink
Trying to fix #10164 (crash on zoom in/out)
Browse files Browse the repository at this point in the history
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 e6b337e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/gui/qgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() ) );
Expand All @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsmapcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ class QgsMapCanvasRendererSync : public QObject
protected:
QgsMapCanvas* mCanvas;
QgsMapRenderer* mRenderer;

bool mSyncingExtent;
};


Expand Down

0 comments on commit e6b337e

Please sign in to comment.