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 Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ QgsLegend::QgsLegend( QgsMapCanvas *canvas, QWidget * parent, const char *name )
, mMapCanvas( canvas )
, mMinimumIconSize( 20, 20 )
, mChanging( false )
, mUpdateDrawingOrder( false )
{
setObjectName( name );

Expand Down
5 changes: 4 additions & 1 deletion src/app/qgsprojectproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,14 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
QGis::UnitType myUnit = myRenderer->mapUnits();
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
bool myProjectionEnabled = myRenderer->hasCrsTransformEnabled();
cbxProjectionEnabled->setChecked( myProjectionEnabled );

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

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

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


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

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

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

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

Expand Down

0 comments on commit 603f35c

Please sign in to comment.