Skip to content
Permalink
Browse files

fix canvas refresh to avoid crashes

git-svn-id: http://svn.osgeo.org/qgis/trunk@15254 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
brushtyler
brushtyler committed Feb 23, 2011
1 parent 26cc17c commit 158266d711e21fdd8075aeaaaef8091b7d14c4f6
Showing with 6 additions and 12 deletions.
  1. +6 −10 src/gui/qgsmapcanvas.cpp
  2. +0 −2 src/gui/qgsmapcanvas.h
@@ -81,7 +81,7 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name )
: QGraphicsView( parent )
, mCanvasProperties( new CanvasProperties )
, mPainting( false )
, mLastSize( QSize() )
, mNewSize( QSize() )
{
mScene = new QGraphicsScene();
setScene( mScene );
@@ -945,9 +945,6 @@ void QgsMapCanvas::paintEvent( QPaintEvent *e )
{
if ( mNewSize.isValid() )
{
mLastSize = mNewSize;
mNewSize = QSize();

if ( mPainting || mDrawing )
{
//cancel current render progress
@@ -964,16 +961,15 @@ void QgsMapCanvas::paintEvent( QPaintEvent *e )

mPainting = true;

while ( mLastSize.isValid() )
while ( mNewSize.isValid() )
{
int width = mLastSize.width();
int height = mLastSize.height();
mLastSize = QSize();
QSize lastSize = mNewSize;
mNewSize = QSize();

//set map size before scene size helps keep scene indexes updated properly
// this was the cause of rubberband artifacts
mMap->resize( QSize( width, height ) );
mScene->setSceneRect( QRectF( 0, 0, width, height ) );
mMap->resize( lastSize );
mScene->setSceneRect( QRectF( 0, 0, lastSize.width(), lastSize.height() ) );

// notify canvas items of change
updateCanvasItemPositions();
@@ -463,8 +463,6 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! currently in paint event
bool mPainting;

//! size of last resize event
QSize mLastSize;
}; // class QgsMapCanvas


0 comments on commit 158266d

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