mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
More Coverity memory leak fixes
This commit is contained in:
parent
481b1647fc
commit
ec01d7698e
@ -195,6 +195,9 @@ class QgsExpression
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Function( const QString& fnname, int params, const QString& group, const QString& helpText = QString(), bool usesGeometry = false, QStringList referencedColumns = QStringList(), bool lazyEval = false );
|
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. */
|
/** The name of the function. */
|
||||||
QString name();
|
QString name();
|
||||||
/** The number of parameters this function takes. */
|
/** The number of parameters this function takes. */
|
||||||
|
@ -446,7 +446,7 @@ QgsPoint QgsGeometry::vertexAt( int atVertex ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QgsVertexId vId;
|
QgsVertexId vId;
|
||||||
vertexIdFromVertexNr( atVertex, vId );
|
( void )vertexIdFromVertexNr( atVertex, vId );
|
||||||
if ( vId.vertex < 0 )
|
if ( vId.vertex < 0 )
|
||||||
{
|
{
|
||||||
return QgsPoint( 0, 0 );
|
return QgsPoint( 0, 0 );
|
||||||
@ -982,7 +982,7 @@ QgsMultiPoint QgsGeometry::asMultiPoint() const
|
|||||||
QgsMultiPoint multiPoint( nPoints );
|
QgsMultiPoint multiPoint( nPoints );
|
||||||
for ( int i = 0; i < nPoints; ++i )
|
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].setX( pt->x() );
|
||||||
multiPoint[i].setY( pt->y() );
|
multiPoint[i].setY( pt->y() );
|
||||||
}
|
}
|
||||||
|
@ -288,6 +288,9 @@ class CORE_EXPORT QgsExpression
|
|||||||
public:
|
public:
|
||||||
Function( const QString& fnname, int params, QString group, QString helpText = QString(), bool usesGeometry = false, QStringList referencedColumns = QStringList(), bool lazyEval = false )
|
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 ) {}
|
: mName( fnname ), mParams( params ), mUsesGeometry( usesGeometry ), mGroup( group ), mHelpText( helpText ), mReferencedColumns( referencedColumns ), mLazyEval( lazyEval ) {}
|
||||||
|
|
||||||
|
virtual ~Function() {}
|
||||||
|
|
||||||
/** The name of the function. */
|
/** The name of the function. */
|
||||||
QString name() { return mName; }
|
QString name() { return mName; }
|
||||||
/** The number of parameters this function takes. */
|
/** 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() )
|
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 ) {}
|
: 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
|
virtual QVariant func( const QVariantList& values, const QgsFeature* f, QgsExpression* parent ) override
|
||||||
{
|
{
|
||||||
return mFnc( values, f, parent );
|
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 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 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:
|
protected:
|
||||||
Node* mNode;
|
Node* mNode;
|
||||||
NodeList* mList;
|
NodeList* mList;
|
||||||
bool mNotIn;
|
bool mNotIn;
|
||||||
};
|
};
|
||||||
|
@ -171,7 +171,7 @@ bool QgsGraduatedHistogramEventFilter::eventFilter( QObject *object, QEvent *eve
|
|||||||
{
|
{
|
||||||
case QEvent::MouseButtonPress:
|
case QEvent::MouseButtonPress:
|
||||||
{
|
{
|
||||||
const QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent* >( event );
|
const QMouseEvent* mouseEvent = static_cast<QMouseEvent* >( event );
|
||||||
if ( mouseEvent->button() == Qt::LeftButton )
|
if ( mouseEvent->button() == Qt::LeftButton )
|
||||||
{
|
{
|
||||||
emit mousePress( posToValue( mouseEvent->pos() ) );
|
emit mousePress( posToValue( mouseEvent->pos() ) );
|
||||||
@ -180,7 +180,7 @@ bool QgsGraduatedHistogramEventFilter::eventFilter( QObject *object, QEvent *eve
|
|||||||
}
|
}
|
||||||
case QEvent::MouseButtonRelease:
|
case QEvent::MouseButtonRelease:
|
||||||
{
|
{
|
||||||
const QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent* >( event );
|
const QMouseEvent* mouseEvent = static_cast<QMouseEvent* >( event );
|
||||||
if ( mouseEvent->button() == Qt::LeftButton )
|
if ( mouseEvent->button() == Qt::LeftButton )
|
||||||
{
|
{
|
||||||
emit mouseRelease( posToValue( mouseEvent->pos() ) );
|
emit mouseRelease( posToValue( mouseEvent->pos() ) );
|
||||||
|
@ -40,7 +40,7 @@ class ItemDelegate : public QItemDelegate
|
|||||||
QSize sizeHint( const QStyleOptionViewItem& /*option*/, const QModelIndex & index ) const override
|
QSize sizeHint( const QStyleOptionViewItem& /*option*/, const QModelIndex & index ) const override
|
||||||
{
|
{
|
||||||
return mModel->item( index.row() )->icon().actualSize( QSize( 512, 512 ) );
|
return mModel->item( index.row() )->icon().actualSize( QSize( 512, 512 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStandardItemModel* mModel;
|
QStandardItemModel* mModel;
|
||||||
@ -162,7 +162,7 @@ void QgsSizeScaleWidget::updatePreview()
|
|||||||
{
|
{
|
||||||
QScopedPointer< QgsMarkerSymbolV2 > symbol( dynamic_cast<QgsMarkerSymbolV2*>( mSymbol->clone() ) );
|
QScopedPointer< QgsMarkerSymbolV2 > symbol( dynamic_cast<QgsMarkerSymbolV2*>( mSymbol->clone() ) );
|
||||||
symbol->setDataDefinedSize( QgsDataDefined() );
|
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] ) );
|
symbol->setSize( expr->size( breaks[i] ) );
|
||||||
QgsSymbolV2LegendNode node( mLayerTreeLayer, QgsLegendSymbolItemV2( symbol.data(), QString::number( i ), 0 ) );
|
QgsSymbolV2LegendNode node( mLayerTreeLayer, QgsLegendSymbolItemV2( symbol.data(), QString::number( i ), 0 ) );
|
||||||
const QSize sz( node.minimumIconSize() );
|
const QSize sz( node.minimumIconSize() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user