Skip to content

Commit ac6c324

Browse files
committedAug 28, 2015
Coverity uninitialized member fixes
1 parent 253e131 commit ac6c324

File tree

9 files changed

+33
-9
lines changed

9 files changed

+33
-9
lines changed
 

‎python/gui/attributetable/qgsfieldconditionalformatwidget.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class QgsFieldConditionalFormatWidget : QWidget
1717
*/
1818
explicit QgsFieldConditionalFormatWidget( QWidget *parent /TransferThis/ = 0 );
1919

20+
~QgsFieldConditionalFormatWidget();
21+
2022
/** Switches the widget to the rules page.
2123
*/
2224
void viewRules();

‎src/app/qgisapp.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,8 @@ QgisApp::~QgisApp()
10291029
delete mMapTools.mSplitParts;
10301030
delete mMapTools.mSvgAnnotation;
10311031
delete mMapTools.mTextAnnotation;
1032+
delete mMapTools.mCircularStringCurvePoint;
1033+
delete mMapTools.mCircularStringRadius;
10321034

10331035
delete mpMaptip;
10341036

@@ -1148,7 +1150,7 @@ void QgisApp::readSettings()
11481150
QStringList oldRecentProjects = settings.value( "/UI/recentProjectsList" ).toStringList();
11491151
settings.remove( "/UI/recentProjectsList" );
11501152

1151-
Q_FOREACH( const QString& project, oldRecentProjects )
1153+
Q_FOREACH ( const QString& project, oldRecentProjects )
11521154
{
11531155
QgsWelcomePageItemsModel::RecentProjectData data;
11541156
data.path = project;
@@ -1160,7 +1162,7 @@ void QgisApp::readSettings()
11601162
settings.beginGroup( "/UI/recentProjects" );
11611163
QStringList projectKeys = settings.childGroups();
11621164

1163-
Q_FOREACH( const QString& key, projectKeys )
1165+
Q_FOREACH ( const QString& key, projectKeys )
11641166
{
11651167
QgsWelcomePageItemsModel::RecentProjectData data;
11661168
settings.beginGroup( key );
@@ -2738,7 +2740,7 @@ void QgisApp::updateRecentProjectPaths()
27382740
{
27392741
mRecentProjectsMenu->clear();
27402742

2741-
Q_FOREACH( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
2743+
Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
27422744
{
27432745
QAction* action = mRecentProjectsMenu->addAction( QString( "%1 (%2)" ).arg( recentProject.title ).arg( recentProject.path ) );
27442746
action->setEnabled( QFile::exists(( recentProject.path ) ) );
@@ -2807,7 +2809,7 @@ void QgisApp::saveRecentProjectPath( QString projectPath, bool savePreviewImage
28072809
int idx = 0;
28082810

28092811
// Persist the list
2810-
Q_FOREACH( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
2812+
Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
28112813
{
28122814
++idx;
28132815
settings.beginGroup( QString( "/UI/recentProjects/%1" ).arg( idx ) );

‎src/app/qgisapp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
14391439
, mMeasureArea( 0 )
14401440
, mMeasureAngle( 0 )
14411441
, mAddFeature( 0 )
1442+
, mCircularStringCurvePoint( 0 )
1443+
, mCircularStringRadius( 0 )
14421444
, mMoveFeature( 0 )
14431445
, mOffsetCurve( 0 )
14441446
, mReshapeFeatures( 0 )

‎src/app/qgsversioninfo.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818

1919
#include "qgsnetworkaccessmanager.h"
2020

21-
QgsVersionInfo::QgsVersionInfo( QObject *parent ) : QObject( parent )
21+
QgsVersionInfo::QgsVersionInfo( QObject *parent )
22+
: QObject( parent )
23+
, mLatestVersion( 0 )
24+
, mError( QNetworkReply::NoError )
2225
{
2326

2427
}

‎src/core/qgsexpression.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3283,6 +3283,6 @@ bool QgsExpression::Node::prepare( QgsExpression* parent, const QgsExpressionCon
32833283
QVariant QgsExpression::StaticFunction::func( const QVariantList &values, const QgsFeature* f, QgsExpression* parent )
32843284
{
32853285
Q_NOWARN_DEPRECATED_PUSH
3286-
return mFnc( values, f, parent );
3286+
return mFnc ? mFnc( values, f, parent ) : QVariant();
32873287
Q_NOWARN_DEPRECATED_POP
32883288
}

‎src/core/qgsexpression.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ class CORE_EXPORT QgsExpression
437437
bool handlesNull = false )
438438
: Function( fnname, params, group, helpText, usesGeometry, referencedColumns, lazyEval, handlesNull )
439439
, mFnc( fcn )
440+
, mContextFnc( 0 )
440441
, mAliases( aliases )
441442
{}
442443

@@ -455,6 +456,7 @@ class CORE_EXPORT QgsExpression
455456
const QStringList& aliases = QStringList(),
456457
bool handlesNull = false )
457458
: Function( fnname, params, group, helpText, usesGeometry, referencedColumns, lazyEval, handlesNull )
459+
, mFnc( 0 )
458460
, mContextFnc( fcn )
459461
, mAliases( aliases )
460462
{}
@@ -468,7 +470,7 @@ class CORE_EXPORT QgsExpression
468470
*/
469471
virtual QVariant func( const QVariantList& values, const QgsExpressionContext* context, QgsExpression* parent ) override
470472
{
471-
return mContextFnc( values, context, parent );
473+
return mContextFnc ? mContextFnc( values, context, parent ) : QVariant();
472474
}
473475

474476
virtual QStringList aliases() const override { return mAliases; }

‎src/gui/attributetable/qgsfieldconditionalformatwidget.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
#include "qgssymbollayerv2utils.h"
77
#include "qgsstylev2.h"
88

9-
QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *parent ) :
10-
QWidget( parent )
9+
QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *parent )
10+
: QWidget( parent )
11+
, mLayer( 0 )
12+
, mEditIndex( 0 )
1113
, mEditing( false )
14+
, mSymbol( 0 )
1215
{
1316
setupUi( this );
1417
mDeleteButton->hide();
@@ -35,6 +38,11 @@ QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *paren
3538
setPresets( defaultPresets() );
3639
}
3740

41+
QgsFieldConditionalFormatWidget::~QgsFieldConditionalFormatWidget()
42+
{
43+
delete mSymbol;
44+
}
45+
3846
void QgsFieldConditionalFormatWidget::updateIcon()
3947
{
4048
mSymbol = QgsSymbolV2::defaultSymbol( QGis::Point );

‎src/gui/attributetable/qgsfieldconditionalformatwidget.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ class GUI_EXPORT QgsFieldConditionalFormatWidget : public QWidget, private Ui::Q
4141
*/
4242
explicit QgsFieldConditionalFormatWidget( QWidget *parent = 0 );
4343

44+
~QgsFieldConditionalFormatWidget();
45+
4446
/** Switches the widget to the rules page.
4547
*/
4648
void viewRules();

‎tests/src/core/testqgscomposermap.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class TestQgsComposerMap : public QObject
3939
, mComposerMap( 0 )
4040
, mMapSettings( 0 )
4141
, mRasterLayer( 0 )
42+
, mPointsLayer( 0 )
43+
, mPolysLayer( 0 )
44+
, mLinesLayer( 0 )
4245
{}
4346

4447
private slots:

0 commit comments

Comments
 (0)
Please sign in to comment.