Skip to content

Commit

Permalink
Correctly emit composerRemoved signal after removing composer
Browse files Browse the repository at this point in the history
from print composers list, fixes composer manager showing
invalid old compositions when loading new project (fix #12612)

Cherry-picked from 3530e4c
  • Loading branch information
nyalldawson committed Jun 24, 2015
1 parent df9e596 commit 174943e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -5656,21 +5656,23 @@ void QgisApp::deletePrintComposers()
QSet<QgsComposer*>::iterator it = mPrintComposers.begin();
while ( it != mPrintComposers.end() )
{
emit composerWillBeRemoved(( *it )->view() );
QgsComposer* c = ( *it );
emit composerWillBeRemoved( c->view() );
it = mPrintComposers.erase( it );
emit composerRemoved( c->view() );

//save a reference to the composition
QgsComposition* composition = ( *it )->composition();
QgsComposition* composition = c->composition();

//first, delete the composer. This must occur before deleting the composition as some of the cleanup code in
//composer or in composer item widgets may require the composition to still be around
delete( *it );
delete( c );

//next, delete the composition
if ( composition )
{
delete composition;
}
it = mPrintComposers.erase( it );
}
mLastComposerId = 0;
markDirty();
Expand Down

0 comments on commit 174943e

Please sign in to comment.