Skip to content

Commit

Permalink
[composer] Fix crash caused by 7773d4e
Browse files Browse the repository at this point in the history
Don't set the parent object of a composition to a composer view, as
we manage deletion of compositions manually and don't always want
the composition deleted when a view a deleted.
  • Loading branch information
nyalldawson committed Oct 19, 2014
1 parent 8732cbf commit 7798bd8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/app/composer/qgscomposer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
connectCompositionSlots();
connectOtherSlots();

mComposition->setParent( mView );
mView->setComposition( mComposition );
//this connection is set up after setting the view's composition, as we don't want setComposition called
//for new composers
Expand Down
12 changes: 12 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5375,7 +5375,19 @@ void QgisApp::deleteComposer( QgsComposer* c )
mPrintComposersMenu->removeAction( c->windowAction() );
markDirty();
emit composerRemoved( c->view() );

//save a reference to the 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 c;

//next, delete the composition
if ( composition )
{
delete composition;
}
}

QgsComposer* QgisApp::duplicateComposer( QgsComposer* currentComposer, QString title )
Expand Down

0 comments on commit 7798bd8

Please sign in to comment.