Skip to content

Commit 3530e4c

Browse files
committed
Correctly emit composerRemoved signal after removing composer
from print composers list, fixes composer manager showing invalid old compositions when loading new project (fix #12612)
1 parent edc880e commit 3530e4c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/app/qgisapp.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -5729,21 +5729,23 @@ void QgisApp::deletePrintComposers()
57295729
QSet<QgsComposer*>::iterator it = mPrintComposers.begin();
57305730
while ( it != mPrintComposers.end() )
57315731
{
5732-
emit composerWillBeRemoved(( *it )->view() );
5732+
QgsComposer* c = ( *it );
5733+
emit composerWillBeRemoved( c->view() );
5734+
it = mPrintComposers.erase( it );
5735+
emit composerRemoved( c->view() );
57335736

57345737
//save a reference to the composition
5735-
QgsComposition* composition = ( *it )->composition();
5738+
QgsComposition* composition = c->composition();
57365739

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

57415744
//next, delete the composition
57425745
if ( composition )
57435746
{
57445747
delete composition;
57455748
}
5746-
it = mPrintComposers.erase( it );
57475749
}
57485750
mLastComposerId = 0;
57495751
markDirty();

0 commit comments

Comments
 (0)