Skip to content
Permalink
Browse files

[composer] Ensure that composers are deleted before compositions

Fixes some rare crashes when loading projects.
  • Loading branch information
nyalldawson committed Oct 19, 2014
1 parent 64f0fdf commit 7773d4e0a8ff764352dc50525f9d4c6bcf26e7d3
Showing with 12 additions and 1 deletion.
  1. +12 −1 src/app/qgisapp.cpp
@@ -5465,8 +5465,19 @@ void QgisApp::deletePrintComposers()
for ( ; it != mPrintComposers.end(); ++it )
{
emit composerWillBeRemoved(( *it )->view() );
delete(( *it )->composition() );

//save a reference to the composition
QgsComposition* composition = ( *it )->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 );

//next, delete the composition
if ( composition )
{
delete composition;
}
}
mPrintComposers.clear();
mLastComposerId = 0;

0 comments on commit 7773d4e

Please sign in to comment.
You can’t perform that action at this time.