Skip to content

Commit

Permalink
Fix Valgrind warnings about use of initialized memory. Caused by memb…
Browse files Browse the repository at this point in the history
…er variables

not initialized in the constructor.
  • Loading branch information
rouault committed Sep 29, 2012
1 parent 23352ce commit 603f35c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/app/legend/qgslegend.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ QgsLegend::QgsLegend( QgsMapCanvas *canvas, QWidget * parent, const char *name )
, mMapCanvas( canvas ) , mMapCanvas( canvas )
, mMinimumIconSize( 20, 20 ) , mMinimumIconSize( 20, 20 )
, mChanging( false ) , mChanging( false )
, mUpdateDrawingOrder( false )
{ {
setObjectName( name ); setObjectName( name );


Expand Down
5 changes: 4 additions & 1 deletion src/app/qgsprojectproperties.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,11 +66,14 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
QGis::UnitType myUnit = myRenderer->mapUnits(); QGis::UnitType myUnit = myRenderer->mapUnits();
setMapUnits( myUnit ); setMapUnits( myUnit );


// we need to initialize it, since the on_cbxProjectionEnabled_stateChanged()
// callback triggered by setChecked() might use it.
mProjectSrsId = myRenderer->destinationCrs().srsid();

//see if the user wants on the fly projection enabled //see if the user wants on the fly projection enabled
bool myProjectionEnabled = myRenderer->hasCrsTransformEnabled(); bool myProjectionEnabled = myRenderer->hasCrsTransformEnabled();
cbxProjectionEnabled->setChecked( myProjectionEnabled ); cbxProjectionEnabled->setChecked( myProjectionEnabled );


mProjectSrsId = myRenderer->destinationCrs().srsid();
QgsDebugMsg( "Read project CRSID: " + QString::number( mProjectSrsId ) ); QgsDebugMsg( "Read project CRSID: " + QString::number( mProjectSrsId ) );
projectionSelector->setSelectedCrsId( mProjectSrsId ); projectionSelector->setSelectedCrsId( mProjectSrsId );
projectionSelector->setEnabled( myProjectionEnabled ); projectionSelector->setEnabled( myProjectionEnabled );
Expand Down
18 changes: 15 additions & 3 deletions src/core/qgscoordinatereferencesystem.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -47,27 +47,39 @@ CUSTOM_CRS_VALIDATION QgsCoordinateReferenceSystem::mCustomSrsValidation = NULL;
//-------------------------- //--------------------------


QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem() QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem()
: mMapUnits( QGis::UnknownUnit ) : mSrsId( 0 )
, mGeoFlag( false )
, mMapUnits( QGis::UnknownUnit )
, mSRID( 0 )
, mIsValidFlag( 0 ) , mIsValidFlag( 0 )
, mValidationHint( "" ) , mValidationHint( "" )
, mAxisInverted( false)
{ {
mCRS = OSRNewSpatialReference( NULL ); mCRS = OSRNewSpatialReference( NULL );
} }


QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( QString theDefinition ) QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( QString theDefinition )
: mMapUnits( QGis::UnknownUnit ) : mSrsId( 0 )
, mGeoFlag( false )
, mMapUnits( QGis::UnknownUnit )
, mSRID( 0 )
, mIsValidFlag( 0 ) , mIsValidFlag( 0 )
, mValidationHint( "" ) , mValidationHint( "" )
, mAxisInverted( false)
{ {
mCRS = OSRNewSpatialReference( NULL ); mCRS = OSRNewSpatialReference( NULL );
createFromString( theDefinition ); createFromString( theDefinition );
} }




QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( const long theId, CrsType theType ) QgsCoordinateReferenceSystem::QgsCoordinateReferenceSystem( const long theId, CrsType theType )
: mMapUnits( QGis::UnknownUnit ) : mSrsId( 0 )
, mGeoFlag( false )
, mMapUnits( QGis::UnknownUnit )
, mSRID( 0 )
, mIsValidFlag( 0 ) , mIsValidFlag( 0 )
, mValidationHint( "" ) , mValidationHint( "" )
, mAxisInverted( false)
{ {
mCRS = OSRNewSpatialReference( NULL ); mCRS = OSRNewSpatialReference( NULL );
createFromId( theId, theType ); createFromId( theId, theType );
Expand Down
1 change: 1 addition & 0 deletions src/core/qgsmaprenderer.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@


QgsMapRenderer::QgsMapRenderer() QgsMapRenderer::QgsMapRenderer()
{ {
mScale = 1;
mScaleCalculator = new QgsScaleCalculator; mScaleCalculator = new QgsScaleCalculator;
mDistArea = new QgsDistanceArea; mDistArea = new QgsDistanceArea;
mCachedTrForLayer = 0; mCachedTrForLayer = 0;
Expand Down
1 change: 1 addition & 0 deletions src/core/qgsrendercontext.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ QgsRenderContext::QgsRenderContext()
mRenderingStopped( false ), mRenderingStopped( false ),
mScaleFactor( 1.0 ), mScaleFactor( 1.0 ),
mRasterScaleFactor( 1.0 ), mRasterScaleFactor( 1.0 ),
mRendererScale( 1.0 ),
mLabelingEngine( NULL ) mLabelingEngine( NULL )
{ {


Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsscalecombobox.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <QSettings> #include <QSettings>
#include <QLineEdit> #include <QLineEdit>


QgsScaleComboBox::QgsScaleComboBox( QWidget* parent ) : QComboBox( parent ) QgsScaleComboBox::QgsScaleComboBox( QWidget* parent ) : QComboBox( parent ), mScale( 1.0 )
{ {
updateScales(); updateScales();


Expand Down

0 comments on commit 603f35c

Please sign in to comment.