[QGIS Commit] r15254 - trunk/qgis/src/gui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Feb 23 18:58:34 EST 2011
Author: brushtyler
Date: 2011-02-23 15:58:34 -0800 (Wed, 23 Feb 2011)
New Revision: 15254
Modified:
trunk/qgis/src/gui/qgsmapcanvas.cpp
trunk/qgis/src/gui/qgsmapcanvas.h
Log:
fix canvas refresh to avoid crashes
Modified: trunk/qgis/src/gui/qgsmapcanvas.cpp
===================================================================
--- trunk/qgis/src/gui/qgsmapcanvas.cpp 2011-02-23 22:32:58 UTC (rev 15253)
+++ trunk/qgis/src/gui/qgsmapcanvas.cpp 2011-02-23 23:58:34 UTC (rev 15254)
@@ -81,7 +81,7 @@
: QGraphicsView( parent )
, mCanvasProperties( new CanvasProperties )
, mPainting( false )
- , mLastSize( QSize() )
+ , mNewSize( QSize() )
{
mScene = new QGraphicsScene();
setScene( mScene );
@@ -945,9 +945,6 @@
{
if ( mNewSize.isValid() )
{
- mLastSize = mNewSize;
- mNewSize = QSize();
-
if ( mPainting || mDrawing )
{
//cancel current render progress
@@ -964,16 +961,15 @@
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();
Modified: trunk/qgis/src/gui/qgsmapcanvas.h
===================================================================
--- trunk/qgis/src/gui/qgsmapcanvas.h 2011-02-23 22:32:58 UTC (rev 15253)
+++ trunk/qgis/src/gui/qgsmapcanvas.h 2011-02-23 23:58:34 UTC (rev 15254)
@@ -463,8 +463,6 @@
//! currently in paint event
bool mPainting;
- //! size of last resize event
- QSize mLastSize;
}; // class QgsMapCanvas
More information about the QGIS-commit
mailing list