Fix leak when a layout cannot be added

This commit is contained in:
Nyall Dawson 2018-01-23 11:57:28 +10:00
parent 6eed7dea05
commit c1f0657036

View File

@ -44,7 +44,10 @@ bool QgsLayoutManager::addLayout( QgsMasterLayoutInterface *layout )
for ( QgsMasterLayoutInterface *l : qgis::as_const( mLayouts ) ) for ( QgsMasterLayoutInterface *l : qgis::as_const( mLayouts ) )
{ {
if ( l->name() == layout->name() ) if ( l->name() == layout->name() )
{
delete layout;
return false; return false;
}
} }
// ugly, but unavoidable for interfaces... // ugly, but unavoidable for interfaces...