mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Fix crashes in layout manager tests
This commit is contained in:
parent
b8880d46cd
commit
be959628e5
@ -37,7 +37,7 @@ QgsLayoutManager::~QgsLayoutManager()
|
||||
|
||||
bool QgsLayoutManager::addLayout( QgsMasterLayoutInterface *layout )
|
||||
{
|
||||
if ( !layout )
|
||||
if ( !layout || mLayouts.contains( layout ) )
|
||||
return false;
|
||||
|
||||
// check for duplicate name
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user