Skip to content

Commit

Permalink
Coverity uninitialized member fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 28, 2015
1 parent 253e131 commit ac6c324
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 9 deletions.
2 changes: 2 additions & 0 deletions python/gui/attributetable/qgsfieldconditionalformatwidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class QgsFieldConditionalFormatWidget : QWidget
*/
explicit QgsFieldConditionalFormatWidget( QWidget *parent /TransferThis/ = 0 );

~QgsFieldConditionalFormatWidget();

/** Switches the widget to the rules page.
*/
void viewRules();
Expand Down
10 changes: 6 additions & 4 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,8 @@ QgisApp::~QgisApp()
delete mMapTools.mSplitParts;
delete mMapTools.mSvgAnnotation;
delete mMapTools.mTextAnnotation;
delete mMapTools.mCircularStringCurvePoint;
delete mMapTools.mCircularStringRadius;

delete mpMaptip;

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

Q_FOREACH( const QString& project, oldRecentProjects )
Q_FOREACH ( const QString& project, oldRecentProjects )
{
QgsWelcomePageItemsModel::RecentProjectData data;
data.path = project;
Expand All @@ -1160,7 +1162,7 @@ void QgisApp::readSettings()
settings.beginGroup( "/UI/recentProjects" );
QStringList projectKeys = settings.childGroups();

Q_FOREACH( const QString& key, projectKeys )
Q_FOREACH ( const QString& key, projectKeys )
{
QgsWelcomePageItemsModel::RecentProjectData data;
settings.beginGroup( key );
Expand Down Expand Up @@ -2738,7 +2740,7 @@ void QgisApp::updateRecentProjectPaths()
{
mRecentProjectsMenu->clear();

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

// Persist the list
Q_FOREACH( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
{
++idx;
settings.beginGroup( QString( "/UI/recentProjects/%1" ).arg( idx ) );
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
, mMeasureArea( 0 )
, mMeasureAngle( 0 )
, mAddFeature( 0 )
, mCircularStringCurvePoint( 0 )
, mCircularStringRadius( 0 )
, mMoveFeature( 0 )
, mOffsetCurve( 0 )
, mReshapeFeatures( 0 )
Expand Down
5 changes: 4 additions & 1 deletion src/app/qgsversioninfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

#include "qgsnetworkaccessmanager.h"

QgsVersionInfo::QgsVersionInfo( QObject *parent ) : QObject( parent )
QgsVersionInfo::QgsVersionInfo( QObject *parent )
: QObject( parent )
, mLatestVersion( 0 )
, mError( QNetworkReply::NoError )
{

}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3283,6 +3283,6 @@ bool QgsExpression::Node::prepare( QgsExpression* parent, const QgsExpressionCon
QVariant QgsExpression::StaticFunction::func( const QVariantList &values, const QgsFeature* f, QgsExpression* parent )
{
Q_NOWARN_DEPRECATED_PUSH
return mFnc( values, f, parent );
return mFnc ? mFnc( values, f, parent ) : QVariant();
Q_NOWARN_DEPRECATED_POP
}
4 changes: 3 additions & 1 deletion src/core/qgsexpression.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ class CORE_EXPORT QgsExpression
bool handlesNull = false )
: Function( fnname, params, group, helpText, usesGeometry, referencedColumns, lazyEval, handlesNull )
, mFnc( fcn )
, mContextFnc( 0 )
, mAliases( aliases )
{}

Expand All @@ -455,6 +456,7 @@ class CORE_EXPORT QgsExpression
const QStringList& aliases = QStringList(),
bool handlesNull = false )
: Function( fnname, params, group, helpText, usesGeometry, referencedColumns, lazyEval, handlesNull )
, mFnc( 0 )
, mContextFnc( fcn )
, mAliases( aliases )
{}
Expand All @@ -468,7 +470,7 @@ class CORE_EXPORT QgsExpression
*/
virtual QVariant func( const QVariantList& values, const QgsExpressionContext* context, QgsExpression* parent ) override
{
return mContextFnc( values, context, parent );
return mContextFnc ? mContextFnc( values, context, parent ) : QVariant();
}

virtual QStringList aliases() const override { return mAliases; }
Expand Down
12 changes: 10 additions & 2 deletions src/gui/attributetable/qgsfieldconditionalformatwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
#include "qgssymbollayerv2utils.h"
#include "qgsstylev2.h"

QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *parent ) :
QWidget( parent )
QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *parent )
: QWidget( parent )
, mLayer( 0 )
, mEditIndex( 0 )
, mEditing( false )
, mSymbol( 0 )
{
setupUi( this );
mDeleteButton->hide();
Expand All @@ -35,6 +38,11 @@ QgsFieldConditionalFormatWidget::QgsFieldConditionalFormatWidget( QWidget *paren
setPresets( defaultPresets() );
}

QgsFieldConditionalFormatWidget::~QgsFieldConditionalFormatWidget()
{
delete mSymbol;
}

void QgsFieldConditionalFormatWidget::updateIcon()
{
mSymbol = QgsSymbolV2::defaultSymbol( QGis::Point );
Expand Down
2 changes: 2 additions & 0 deletions src/gui/attributetable/qgsfieldconditionalformatwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class GUI_EXPORT QgsFieldConditionalFormatWidget : public QWidget, private Ui::Q
*/
explicit QgsFieldConditionalFormatWidget( QWidget *parent = 0 );

~QgsFieldConditionalFormatWidget();

/** Switches the widget to the rules page.
*/
void viewRules();
Expand Down
3 changes: 3 additions & 0 deletions tests/src/core/testqgscomposermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class TestQgsComposerMap : public QObject
, mComposerMap( 0 )
, mMapSettings( 0 )
, mRasterLayer( 0 )
, mPointsLayer( 0 )
, mPolysLayer( 0 )
, mLinesLayer( 0 )
{}

private slots:
Expand Down

0 comments on commit ac6c324

Please sign in to comment.