[PATCH libreoffice-4-0] fdo#60910: discard UNO shape object in SdrObject::SetPage

Luke Deller (via Code Review) gerrit at gerrit.libreoffice.org
Mon Apr 29 05:07:46 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3662

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/62/3662/1

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
---
M svx/source/svdraw/svdobj.cxx
1 file changed, 12 insertions(+), 0 deletions(-)



diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 35b89c0..f7045fe 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -567,12 +567,24 @@
 
 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

-- 
To view, visit https://gerrit.libreoffice.org/3662
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id37593fe5578afe06cd967bf0b0b7d56922fe4af
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Luke Deller <luke at deller.id.au>



More information about the LibreOffice mailing list