Skip to content
Permalink
Browse files
More Coverity memory leak fixes
  • Loading branch information
nyalldawson committed May 27, 2015
1 parent 481b164 commit ec01d7698e814fa430ffa913c2e2443f615d7068
@@ -195,6 +195,9 @@ class QgsExpression
{
public:
Function( const QString& fnname, int params, const QString& group, const QString& helpText = QString(), bool usesGeometry = false, QStringList referencedColumns = QStringList(), bool lazyEval = false );

virtual ~Function();

/** The name of the function. */
QString name();
/** The number of parameters this function takes. */
@@ -446,7 +446,7 @@ QgsPoint QgsGeometry::vertexAt( int atVertex ) const
}

QgsVertexId vId;
vertexIdFromVertexNr( atVertex, vId );
( void )vertexIdFromVertexNr( atVertex, vId );
if ( vId.vertex < 0 )
{
return QgsPoint( 0, 0 );
@@ -982,7 +982,7 @@ QgsMultiPoint QgsGeometry::asMultiPoint() const
QgsMultiPoint multiPoint( nPoints );
for ( int i = 0; i < nPoints; ++i )
{
const QgsPointV2* pt = dynamic_cast<const QgsPointV2*>( mp->geometryN( i ) );
const QgsPointV2* pt = static_cast<const QgsPointV2*>( mp->geometryN( i ) );
multiPoint[i].setX( pt->x() );
multiPoint[i].setY( pt->y() );
}
@@ -288,6 +288,9 @@ class CORE_EXPORT QgsExpression
public:
Function( const QString& fnname, int params, QString group, QString helpText = QString(), bool usesGeometry = false, QStringList referencedColumns = QStringList(), bool lazyEval = false )
: mName( fnname ), mParams( params ), mUsesGeometry( usesGeometry ), mGroup( group ), mHelpText( helpText ), mReferencedColumns( referencedColumns ), mLazyEval( lazyEval ) {}

virtual ~Function() {}

/** The name of the function. */
QString name() { return mName; }
/** The number of parameters this function takes. */
@@ -340,6 +343,8 @@ class CORE_EXPORT QgsExpression
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() )
: Function( fnname, params, group, helpText, usesGeometry, referencedColumns, lazyEval ), mFnc( fcn ), mAliases( aliases ) {}

virtual ~StaticFunction() {}

virtual QVariant func( const QVariantList& values, const QgsFeature* f, QgsExpression* parent ) override
{
return mFnc( values, f, parent );
@@ -537,10 +542,10 @@ class CORE_EXPORT QgsExpression

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

protected:
Node* mNode;
protected:
Node* mNode;
NodeList* mList;
bool mNotIn;
};
@@ -171,7 +171,7 @@ bool QgsGraduatedHistogramEventFilter::eventFilter( QObject *object, QEvent *eve
{
case QEvent::MouseButtonPress:
{
const QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent* >( event );
const QMouseEvent* mouseEvent = static_cast<QMouseEvent* >( event );
if ( mouseEvent->button() == Qt::LeftButton )
{
emit mousePress( posToValue( mouseEvent->pos() ) );
@@ -180,7 +180,7 @@ bool QgsGraduatedHistogramEventFilter::eventFilter( QObject *object, QEvent *eve
}
case QEvent::MouseButtonRelease:
{
const QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent* >( event );
const QMouseEvent* mouseEvent = static_cast<QMouseEvent* >( event );
if ( mouseEvent->button() == Qt::LeftButton )
{
emit mouseRelease( posToValue( mouseEvent->pos() ) );
@@ -40,7 +40,7 @@ class ItemDelegate : public QItemDelegate
QSize sizeHint( const QStyleOptionViewItem& /*option*/, const QModelIndex & index ) const override
{
return mModel->item( index.row() )->icon().actualSize( QSize( 512, 512 ) );
}
}

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

0 comments on commit ec01d76

Please sign in to comment.