Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 7773d4e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 7773d4e

Please sign in to comment.