From 1266429e91a56bcce59a7b98523e8edb8b22ed18 Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Tue, 10 Nov 2015 10:09:13 +0100 Subject: tdf#90357 create correct undo action when merging in pages from another model the already cloned page references a masterpage from the old model. To not create an undo action that falsely reflects that, remove the masterpage from the page first. This reflects better what happens in this state, setting the masterpage for this page the first time. Change-Id: I0288268cb0963ddc2e8446661ffd30a94a0744d2 --- svx/source/svdraw/svdmodel.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'svx') diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index de7e1c62fc33..7a688dac7c6d 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -1760,6 +1760,14 @@ void SdrModel::Merge(SdrModel& rSourceModel, if(nNeuNum != 0xFFFF) { + // tdf#90357 here pPg and the to-be-set new masterpage are parts of the new model + // already, but the currently set masterpage is part of the old model. Remove master + // page from already cloned page to prevent creating wrong undo action that can + // eventually crash the app. + // Do *not* remove it directly after cloning - the old masterpage is still needed + // later to find the new to-be-set masterpage. + pPg->TRG_ClearMasterPage(); + if(bUndo) { AddUndo(GetSdrUndoFactory().CreateUndoPageChangeMasterPage(*pPg)); -- cgit v1.2.3