Skip to content

Commit ec01d76

Browse files
committedMay 27, 2015
More Coverity memory leak fixes
1 parent 481b164 commit ec01d76

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed
 

‎python/core/qgsexpression.sip

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ class QgsExpression
195195
{
196196
public:
197197
Function( const QString& fnname, int params, const QString& group, const QString& helpText = QString(), bool usesGeometry = false, QStringList referencedColumns = QStringList(), bool lazyEval = false );
198+
199+
virtual ~Function();
200+
198201
/** The name of the function. */
199202
QString name();
200203
/** The number of parameters this function takes. */

‎src/core/geometry/qgsgeometry.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ QgsPoint QgsGeometry::vertexAt( int atVertex ) const
446446
}
447447

448448
QgsVertexId vId;
449-
vertexIdFromVertexNr( atVertex, vId );
449+
( void )vertexIdFromVertexNr( atVertex, vId );
450450
if ( vId.vertex < 0 )
451451
{
452452
return QgsPoint( 0, 0 );
@@ -982,7 +982,7 @@ QgsMultiPoint QgsGeometry::asMultiPoint() const
982982
QgsMultiPoint multiPoint( nPoints );
983983
for ( int i = 0; i < nPoints; ++i )
984984
{
985-
const QgsPointV2* pt = dynamic_cast<const QgsPointV2*>( mp->geometryN( i ) );
985+
const QgsPointV2* pt = static_cast<const QgsPointV2*>( mp->geometryN( i ) );
986986
multiPoint[i].setX( pt->x() );
987987
multiPoint[i].setY( pt->y() );
988988
}

‎src/core/qgsexpression.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ class CORE_EXPORT QgsExpression
288288
public:
289289
Function( const QString& fnname, int params, QString group, QString helpText = QString(), bool usesGeometry = false, QStringList referencedColumns = QStringList(), bool lazyEval = false )
290290
: mName( fnname ), mParams( params ), mUsesGeometry( usesGeometry ), mGroup( group ), mHelpText( helpText ), mReferencedColumns( referencedColumns ), mLazyEval( lazyEval ) {}
291+
292+
virtual ~Function() {}
293+
291294
/** The name of the function. */
292295
QString name() { return mName; }
293296
/** The number of parameters this function takes. */
@@ -340,6 +343,8 @@ class CORE_EXPORT QgsExpression
340343
StaticFunction( QString fnname, int params, FcnEval fcn, QString group, QString helpText = QString(), bool usesGeometry = false, QStringList referencedColumns = QStringList(), bool lazyEval = false, const QStringList& aliases = QStringList() )
341344
: Function( fnname, params, group, helpText, usesGeometry, referencedColumns, lazyEval ), mFnc( fcn ), mAliases( aliases ) {}
342345

346+
virtual ~StaticFunction() {}
347+
343348
virtual QVariant func( const QVariantList& values, const QgsFeature* f, QgsExpression* parent ) override
344349
{
345350
return mFnc( values, f, parent );
@@ -537,10 +542,10 @@ class CORE_EXPORT QgsExpression
537542

538543
virtual QStringList referencedColumns() const override { QStringList lst( mNode->referencedColumns() ); foreach ( Node* n, mList->list() ) lst.append( n->referencedColumns() ); return lst; }
539544
virtual bool needsGeometry() const override { bool needs = false; foreach ( Node* n, mList->list() ) needs |= n->needsGeometry(); return needs; }
540-
virtual void accept( Visitor& v ) const override { v.visit( *this ); }
545+
virtual void accept( Visitor& v ) const override { v.visit( *this ); }
541546

542-
protected:
543-
Node* mNode;
547+
protected:
548+
Node* mNode;
544549
NodeList* mList;
545550
bool mNotIn;
546551
};

‎src/gui/symbology-ng/qgsgraduatedhistogramwidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ bool QgsGraduatedHistogramEventFilter::eventFilter( QObject *object, QEvent *eve
171171
{
172172
case QEvent::MouseButtonPress:
173173
{
174-
const QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent* >( event );
174+
const QMouseEvent* mouseEvent = static_cast<QMouseEvent* >( event );
175175
if ( mouseEvent->button() == Qt::LeftButton )
176176
{
177177
emit mousePress( posToValue( mouseEvent->pos() ) );
@@ -180,7 +180,7 @@ bool QgsGraduatedHistogramEventFilter::eventFilter( QObject *object, QEvent *eve
180180
}
181181
case QEvent::MouseButtonRelease:
182182
{
183-
const QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent* >( event );
183+
const QMouseEvent* mouseEvent = static_cast<QMouseEvent* >( event );
184184
if ( mouseEvent->button() == Qt::LeftButton )
185185
{
186186
emit mouseRelease( posToValue( mouseEvent->pos() ) );

‎src/gui/symbology-ng/qgssizescalewidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ItemDelegate : public QItemDelegate
4040
QSize sizeHint( const QStyleOptionViewItem& /*option*/, const QModelIndex & index ) const override
4141
{
4242
return mModel->item( index.row() )->icon().actualSize( QSize( 512, 512 ) );
43-
}
43+
}
4444

4545
private:
4646
QStandardItemModel* mModel;
@@ -162,7 +162,7 @@ void QgsSizeScaleWidget::updatePreview()
162162
{
163163
QScopedPointer< QgsMarkerSymbolV2 > symbol( dynamic_cast<QgsMarkerSymbolV2*>( mSymbol->clone() ) );
164164
symbol->setDataDefinedSize( QgsDataDefined() );
165-
symbol->setDataDefinedAngle( "" ); // to avoid symbol not beeing drawn
165+
symbol->setDataDefinedAngle( QgsDataDefined() ); // to avoid symbol not beeing drawn
166166
symbol->setSize( expr->size( breaks[i] ) );
167167
QgsSymbolV2LegendNode node( mLayerTreeLayer, QgsLegendSymbolItemV2( symbol.data(), QString::number( i ), 0 ) );
168168
const QSize sz( node.minimumIconSize() );

0 commit comments

Comments
 (0)
Please sign in to comment.