[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Sun Dec 13 04:31:19 PST 2015


 lotuswordpro/source/filter/lwplayout.cxx      |   10 ++++----
 lotuswordpro/source/filter/lwppagelayout.cxx  |   30 +++++++++++++-------------
 lotuswordpro/source/filter/lwptablelayout.cxx |    5 ----
 3 files changed, 21 insertions(+), 24 deletions(-)

New commits:
commit 6fee415ec54c1386cbabb10bec0d7f6e28e17987
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Dec 13 12:29:29 2015 +0000

    deploy references to keep layout alive long enough
    
    Change-Id: I670f00b0beb77e5014c3dd4a4798e69ece882b87
    (cherry picked from commit 1deae8a2d92747ad69b024513ddae93cc8927d29)

diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 3e58fa9..e4a9112 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -330,12 +330,12 @@ LwpVirtualLayout* LwpVirtualLayout::GetParentLayout()
 void LwpVirtualLayout::RegisterChildStyle()
 {
     //Register all children styles
-    LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
-    while(pLayout)
+    rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+    while (xLayout.is())
     {
-        pLayout->SetFoundry(m_pFoundry);
-        pLayout->RegisterStyle();
-        pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
+        xLayout->SetFoundry(m_pFoundry);
+        xLayout->RegisterStyle();
+        xLayout.set(dynamic_cast<LwpVirtualLayout*>(xLayout->GetNext().obj().get()));
     }
 }
 
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index e7fd45d..cd29157 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -503,24 +503,24 @@ void LwpPageLayout::ResetXFColumns()
 
 LwpHeaderLayout* LwpPageLayout::GetHeaderLayout()
 {
-    LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
-    while(pLay)
+    rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+    while (xLay.is())
     {
-        if( pLay->GetLayoutType() == LWP_HEADER_LAYOUT )
-            return ( static_cast<LwpHeaderLayout*> (pLay) );
-        pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext().obj().get());
+        if (xLay->GetLayoutType() == LWP_HEADER_LAYOUT)
+            return dynamic_cast<LwpHeaderLayout*>(xLay.get());
+        xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
     }
     return nullptr;
 }
 
 LwpFooterLayout* LwpPageLayout::GetFooterLayout()
 {
-    LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
-    while(pLay)
+    rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+    while (xLay.is())
     {
-        if( pLay->GetLayoutType() == LWP_FOOTER_LAYOUT )
-            return ( static_cast<LwpFooterLayout*> (pLay) );
-        pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext().obj().get());
+        if (xLay->GetLayoutType() == LWP_FOOTER_LAYOUT)
+            return dynamic_cast<LwpFooterLayout*>(xLay.get());
+        xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
     }
     return nullptr;
 }
@@ -533,19 +533,19 @@ LwpPageLayout* LwpPageLayout::GetOddChildLayout()
 {
     if(IsComplex())
     {
-        LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
-        while(pLay)
+        rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+        while (xLay.is())
         {
-            if( pLay->GetLayoutType() == LWP_PAGE_LAYOUT )
+            if (xLay->GetLayoutType() == LWP_PAGE_LAYOUT)
             {
-                LwpPageLayout* pPageLayout = static_cast<LwpPageLayout*> (pLay);
+                LwpPageLayout* pPageLayout = static_cast<LwpPageLayout*>(xLay.get());
                 LwpUseWhen* pUseWhen = pPageLayout->GetUseWhen();
                 if(pUseWhen && pUseWhen->IsUseOnAllOddPages())
                 {
                     return pPageLayout;
                 }
             }
-            pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext().obj().get());
+            xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
         }
     }
     return nullptr;
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index e5b16c7..9783531 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -691,11 +691,8 @@ void LwpTableLayout::RegisterStyle()
 {
     // get super table layout
     LwpSuperTableLayout * pSuper = GetSuperTableLayout();
-    if(!pSuper)
-    {
-        assert(false);
+    if (!pSuper)
         return;
-    }
 
     // get table
     LwpTable * pTable = GetTable();


More information about the Libreoffice-commits mailing list