From 879c36b01d3f806937cfc26b90ebac89e6df87c4 Mon Sep 17 00:00:00 2001 From: Luke Deller Date: Thu, 25 Apr 2013 00:00:54 +1000 Subject: fdo#60910: discard UNO shape object in SdrObject::SetPage The creation of the UNO shape in SdrObject::getUnoShape is influenced by pPage, so when the page changes we need to discard the cached UNO shape so that a new one will be created with the new page. Change-Id: Id37593fe5578afe06cd967bf0b0b7d56922fe4af Reviewed-on: https://gerrit.libreoffice.org/3662 Reviewed-by: David Tardon Tested-by: David Tardon --- svx/source/svdraw/svdobj.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 35b89c0b9b16..f7045fe10864 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -567,12 +567,24 @@ SdrObjList* SdrObject::GetObjList() const void SdrObject::SetPage(SdrPage* pNewPage) { + SdrModel* pOldModel = pModel; + SdrPage* pOldPage = pPage; + pPage=pNewPage; if (pPage!=NULL) { SdrModel* pMod=pPage->GetModel(); if (pMod!=pModel && pMod!=NULL) { SetModel(pMod); }} + + // The creation of the UNO shape in SdrObject::getUnoShape is influenced + // by pPage, so when the page changes we need to discard the cached UNO + // shape so that a new one will be created. + // If the page is changing to another page with the same model, we + // assume they create compatible UNO shape objects so we shouldn't have + // to invalidate. + if (pOldPage != pPage && !(pOldPage && pPage && pOldModel == pModel)) + setUnoShape(NULL); } SdrPage* SdrObject::GetPage() const -- cgit v1.2.3