Skip to content

Commit

Permalink
Fix crashes in layout manager tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 24, 2018
1 parent b8880d4 commit be95962
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/layout/qgslayoutmanager.cpp
Expand Up @@ -37,7 +37,7 @@ QgsLayoutManager::~QgsLayoutManager()

bool QgsLayoutManager::addLayout( QgsMasterLayoutInterface *layout )
{
if ( !layout )
if ( !layout || mLayouts.contains( layout ) )
return false;

// check for duplicate name
Expand Down Expand Up @@ -265,13 +265,12 @@ QgsMasterLayoutInterface *QgsLayoutManager::duplicateLayout( const QgsMasterLayo

newLayout->setName( newName );
QgsMasterLayoutInterface *l = newLayout.get();
if ( !addLayout( l ) )
if ( !addLayout( newLayout.release() ) )
{
return nullptr;
}
else
{
( void )newLayout.release(); //ownership was transferred successfully
return l;
}
}
Expand Down

0 comments on commit be95962

Please sign in to comment.