Skip to content

Commit

Permalink
Avoid a cpp check dangling pointer warning
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 15, 2023
1 parent e3af648 commit eda48ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/app/layers/qgsapplayerhandling.cpp
Expand Up @@ -1540,9 +1540,7 @@ void QgsAppLayerHandling::resolveVectorLayerDependencies( QgsVectorLayer *vl, Qg
std::unique_ptr< QgsVectorLayer > newVl = std::make_unique< QgsVectorLayer >( layerUri, !dependency.name.isEmpty() ? dependency.name : tableName, providerName );
if ( newVl->isValid() )
{
QgsVectorLayer *res = newVl.get();
QgsProject::instance()->addMapLayer( newVl.release() );
return res;
return qobject_cast< QgsVectorLayer *>( QgsProject::instance()->addMapLayer( newVl.release() ) );
}
}
catch ( QgsProviderConnectionException & )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsstatisticalsummarydockwidget.h
Expand Up @@ -134,7 +134,7 @@ class APP_EXPORT QgsStatisticalSummaryDockWidget : public QgsDockWidget, private

QString mExpression;

QgsStatisticsValueGatherer *mGatherer = nullptr;
QPointer< QgsStatisticsValueGatherer > mGatherer;

bool mPendingCalculate = false;
};
Expand Down

0 comments on commit eda48ee

Please sign in to comment.