Skip to content

Commit

Permalink
explicitly discard return value when releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
uclaros authored and nyalldawson committed Feb 13, 2025
1 parent 4b4cb2f commit f6965e2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/stac/qgsstacdataitems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ void QgsStacItemItem::setStacItem( std::unique_ptr< QgsStacObject > &object )
{
QgsStacItem *item = dynamic_cast<QgsStacItem *>( object.get() );
if ( item )
object.release();
{
// release object, mStacItem will take ownership of the successfully cast item
( void )object.release();
}

mStacItem.reset( item );
updateToolTip();
Expand Down Expand Up @@ -463,7 +466,10 @@ void QgsStacCatalogItem::setStacCatalog( std::unique_ptr< QgsStacObject > &objec
{
QgsStacCatalog *catalog = dynamic_cast<QgsStacCatalog *>( object.get() );
if ( catalog )
object.release();
{
// release object, mStacCatalog will take ownership of the successfully cast catalog
( void )object.release();
}

mStacCatalog.reset( catalog );
if ( mStacCatalog )
Expand Down

0 comments on commit f6965e2

Please sign in to comment.