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

Caolán McNamara caolanm at redhat.com
Sun Dec 13 11:39:56 PST 2015


 lotuswordpro/source/filter/lwpframelayout.cxx |   69 +++++++++++++------------
 lotuswordpro/source/filter/lwpfribframe.cxx   |    6 +-
 lotuswordpro/source/filter/lwpfribtable.cxx   |   10 +--
 lotuswordpro/source/filter/lwplayout.cxx      |   71 ++++++++++++--------------
 lotuswordpro/source/filter/lwplayout.hxx      |    6 +-
 lotuswordpro/source/filter/lwpstory.cxx       |    4 -
 lotuswordpro/source/filter/lwptablelayout.cxx |    4 -
 lotuswordpro/source/filter/lwptoc.cxx         |    5 +
 8 files changed, 89 insertions(+), 86 deletions(-)

New commits:
commit 3dd642dae33ca724c42e358520e2cfb6e601cdb3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Dec 13 19:34:43 2015 +0000

    need more References for life cycle fixes here
    
    32nd and final distinct crash fix of this sequence
    
    Change-Id: Ib9f41091737e66995f332c06083d51408eb1497b
    (cherry picked from commit 9550737e5db7415a679aec8a64d6f724962b8750)

diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index 7312e81..e0baf18 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -187,35 +187,35 @@ void  LwpFrame::RegisterStyle(XFFrameStyle* pFrameStyle)
  void LwpFrame::XFConvert(XFContentContainer* pCont)
  {
     // parse the frame which anchor to page
-    LwpVirtualLayout* pParent = m_pLayout->GetParentLayout();
-    if (!pParent)
+    rtl::Reference<LwpVirtualLayout> xParent = m_pLayout->GetParentLayout();
+    if (!xParent.is())
         throw std::runtime_error("missing Parent Layout");
-    if (pParent->IsPage() && pParent->GetParentLayout() && pParent->GetParentLayout()->IsPage())
+    if (xParent->IsPage() && xParent->GetParentLayout().is() && xParent->GetParentLayout()->IsPage())
     {
         //for mirror page, problems exist if the parent layout is header or footer layout,
-        pParent = pParent->GetParentLayout();
+        xParent = xParent->GetParentLayout();
     }
-    if(m_pLayout->IsAnchorPage()&& pParent->IsPage())
+    if(m_pLayout->IsAnchorPage()&& xParent->IsPage())
     {
         //get parent layout
         if(m_pLayout->IsUseOnPage())
         {
-            sal_Int32 nPageNo = pParent->GetPageNumber(m_pLayout->GetUsePage());
+            sal_Int32 nPageNo = xParent->GetPageNumber(m_pLayout->GetUsePage());
             if(nPageNo>0)
                 m_pLayout->XFConvertFrame(pCont, nPageNo);
         }
         else if(m_pLayout->IsUseOnAllPages())
         {
-            sal_Int32 nFirst = pParent->GetPageNumber(FIRST_LAYOUTPAGENO);
-            sal_Int32 nLast = pParent->GetPageNumber(LAST_LAYOUTPAGENO);
+            sal_Int32 nFirst = xParent->GetPageNumber(FIRST_LAYOUTPAGENO);
+            sal_Int32 nLast = xParent->GetPageNumber(LAST_LAYOUTPAGENO);
             if(nLast > 0)
                 m_pLayout->XFConvertFrame(pCont, nFirst, nLast, true);
 
         }
         else if(m_pLayout->IsUseOnAllOddPages()||m_pLayout->IsUseOnAllEvenPages())
         {
-            sal_Int32 nFirst = pParent->GetPageNumber(FIRST_LAYOUTPAGENO);
-            sal_Int32 nLast = pParent->GetPageNumber(LAST_LAYOUTPAGENO);
+            sal_Int32 nFirst = xParent->GetPageNumber(FIRST_LAYOUTPAGENO);
+            sal_Int32 nLast = xParent->GetPageNumber(LAST_LAYOUTPAGENO);
             if(nLast > 0)
             {
                 sal_uInt16 first = static_cast<sal_uInt16>(nFirst);
@@ -254,7 +254,8 @@ void LwpFrame::ApplyWrapType(XFFrameStyle *pFrameStyle)
             //between the frame object and page margins
 
             eWrap = enumXFWrapBest;
-            LwpMiddleLayout* pParent = static_cast<LwpMiddleLayout*>(m_pLayout->GetContainerLayout());
+            rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+            LwpMiddleLayout* pParent = dynamic_cast<LwpMiddleLayout*>(xContainer.get());
             if(pParent)
             {
                 if(IsLeftWider())
@@ -434,8 +435,8 @@ void LwpFrame::ApplyPosType(XFFrameStyle* pFrameStyle)
             //set vertical position
             if(m_pLayout->IsAnchorPage())//in page
             {
-                LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
-                if(pContainer && (pContainer->IsHeader() || pContainer->IsFooter()))
+                rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+                if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))
                 {
                     //Only anchor to para, the frame can display in header and footer of each page
                     eYPos = enumXFFrameYPosFromTop; //from top
@@ -465,15 +466,15 @@ void LwpFrame::ApplyPosType(XFFrameStyle* pFrameStyle)
             eXPos = enumXFFrameXPosFromLeft;
             eXRel = enumXFFrameXRelPage;
             //set vertical position
-            LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
-            if(pContainer && pContainer->IsPage())//in page
+            rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+            if (xContainer.is() && xContainer->IsPage())//in page
             {
                 //eYPos = enumXFFrameYPosFromTop;
                 //eYRel = enumXFFrameYRelPage;
                 eYPos = enumXFFrameYPosBelow;
                 eYRel = enumXFFrameYRelChar;
             }
-            else if(pContainer && pContainer->IsFrame()) //in frame
+            else if (xContainer.is() && xContainer->IsFrame()) //in frame
             {
                 eYPos = enumXFFrameYPosFromTop;
                 eYRel = enumXFFrameYRelPage;
@@ -613,11 +614,11 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
             //anchor to page, frame and cell
             if(m_pLayout->IsAnchorPage())//in page
             {
-                LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
-                if(pContainer && (pContainer->IsHeader() || pContainer->IsFooter()))
+                rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+                if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))
                 {
                     eAnchor = enumXFAnchorPara;
-                    fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
+                    fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
                 }
                 else
                     eAnchor = enumXFAnchorPage;
@@ -630,8 +631,9 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
             {
                 //eAnchor = enumXFAnchorChar;
                 eAnchor = enumXFAnchorPara;
-                LwpMiddleLayout* pContainer = static_cast<LwpMiddleLayout*>(m_pLayout->GetContainerLayout());
-                if(pContainer)
+                rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+                LwpMiddleLayout* pContainer = dynamic_cast<LwpMiddleLayout*>(xContainer.get());
+                if (pContainer)
                 {
                     fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
                 }
@@ -641,26 +643,26 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
         case LwpLayoutRelativityGuts::LAY_PARA_RELATIVE:    //same page as text
         {
             eAnchor = enumXFAnchorChar;
-            LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
-            if(pContainer && pContainer->IsPage())//in page
+            rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+            if (xContainer.is() && xContainer->IsPage())//in page
             {
                 //eAnchor = enumXFAnchorPage;
                 eAnchor = enumXFAnchorChar;// to character
             }
-            else if(pContainer && pContainer->IsFrame()) //in frame
+            else if (xContainer.is() && xContainer->IsFrame()) //in frame
             {
                 eAnchor = enumXFAnchorFrame;
             }
-            else if(pContainer && pContainer->IsCell()) //in cell
+            else if (xContainer.is() && xContainer->IsCell()) //in cell
             {
                 //eAnchor = enumXFAnchorChar;
                 eAnchor = enumXFAnchorPara;
-                fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
+                fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
             }
-            else if(pContainer && (pContainer->IsHeader() || pContainer->IsFooter()))//in header or footer
+            else if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))//in header or footer
             {
                 eAnchor = enumXFAnchorPara;
-                fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
+                fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
             }
             break;
         }
@@ -712,9 +714,9 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
  */
 bool LwpFrame::IsLeftWider()
 {
-    //LwpMiddleLayout* pParent = static_cast<LwpMiddleLayout*>(m_pLayout->GetContainerLayout());
-    LwpVirtualLayout* pParent = static_cast<LwpVirtualLayout*>(m_pLayout->GetContainerLayout());
-    if(pParent)
+    rtl::Reference<LwpVirtualLayout> xLayout(m_pLayout->GetContainerLayout());
+    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*>(xLayout.get());
+    if (pParent)
     {
         LwpPoint aPoint = m_pLayout->GetOrigin();
         double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
@@ -945,8 +947,9 @@ double LwpFrameLayout::GetWidth()
 double LwpFrameLayout::GetMaxWidth()
 {
     double fActualWidth = 0;
-    LwpMiddleLayout* pParent = static_cast<LwpMiddleLayout*>(GetContainerLayout());
-    if(pParent)
+    rtl::Reference<LwpVirtualLayout> xLayout(GetContainerLayout());
+    LwpMiddleLayout* pParent = dynamic_cast<LwpMiddleLayout*>(xLayout.get());
+    if (pParent)
     {
         LwpPoint aPoint = GetOrigin();
         double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
diff --git a/lotuswordpro/source/filter/lwpfribframe.cxx b/lotuswordpro/source/filter/lwpfribframe.cxx
index 9f039c9..91ee697 100644
--- a/lotuswordpro/source/filter/lwpfribframe.cxx
+++ b/lotuswordpro/source/filter/lwpfribframe.cxx
@@ -150,13 +150,13 @@ void LwpFribFrame::XFConvert(XFContentContainer* pCont)
     sal_uInt8 nType = pLayout->GetRelativeType();
     if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
     {
-        LwpVirtualLayout* pContainerLayout = pLayout->GetContainerLayout();
-        if(pContainerLayout && pContainerLayout->IsFrame())
+        rtl::Reference<LwpVirtualLayout> xContainerLayout(pLayout->GetContainerLayout());
+        if (xContainerLayout.is() && xContainerLayout->IsFrame())
         {
             //same page as text and in frame
             pXFContentContainer = m_pPara->GetXFContainer();
         }
-        else if(pContainerLayout && pContainerLayout->IsCell())
+        else if (xContainerLayout.is() && xContainerLayout->IsCell())
         {
             //same page as text and in cell, get the first xfpara
             rtl::Reference<XFContent> first(
diff --git a/lotuswordpro/source/filter/lwpfribtable.cxx b/lotuswordpro/source/filter/lwpfribtable.cxx
index b4e95bb..e76c25d 100644
--- a/lotuswordpro/source/filter/lwpfribtable.cxx
+++ b/lotuswordpro/source/filter/lwpfribtable.cxx
@@ -102,11 +102,11 @@ void LwpFribTable::XFConvert(XFContentContainer* pCont)
     if (!pSuper)
         return;
     sal_uInt8 nType = pSuper->GetRelativeType();
-    LwpVirtualLayout* pContainer = pSuper->GetContainerLayout();
-    if (!pContainer)
+    rtl::Reference<LwpVirtualLayout> xContainer(pSuper->GetContainerLayout());
+    if (!xContainer.is())
         return;
     if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
-        && !pContainer->IsCell())
+        && !xContainer->IsCell())
     {
         pXFContentContainer = m_pPara->GetXFContainer();
         //delete the additional blank para
@@ -122,11 +122,11 @@ void LwpFribTable::XFConvert(XFContentContainer* pCont)
     else if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
     {
         //same page as text and in frame
-        if(pContainer->IsFrame())
+        if (xContainer->IsFrame())
         {
             pXFContentContainer = m_pPara->GetXFContainer();
         }
-        else if(pContainer->IsCell())
+        else if (xContainer->IsCell())
         {
             //same page as text and in cell, get the first xfpara
             rtl::Reference<XFContent> first(
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 7eeeb51..bb54fc0 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -141,10 +141,10 @@ bool LwpVirtualLayout::HonorProtection()
     if(!(m_nAttributes2 & STYLE2_HONORPROTECTION))
         return false;
 
-    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
-    if (pParent && !pParent->IsHeader())
+    rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+    if (xParent.is() && !xParent->IsHeader())
     {
-        return pParent->GetHonorProtection();
+        return xParent->GetHonorProtection();
     }
 
     if(m_pFoundry)//is null now
@@ -165,10 +165,10 @@ bool LwpVirtualLayout::IsProtected()
 {
     bool bProtected = (m_nAttributes & STYLE_PROTECTED)!=0;
 
-    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
-    if(pParent && !pParent->IsHeader())
+    rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+    if (xParent.is() && !xParent->IsHeader())
     {
-        if(pParent->GetHonorProtection()&&(pParent->GetHasProtection()||bProtected))
+        if (xParent->GetHonorProtection() && (xParent->GetHasProtection()||bProtected))
         {
             return true;
         }
@@ -197,10 +197,10 @@ bool LwpVirtualLayout::HasProtection()
     if(m_nAttributes & STYLE_PROTECTED)
         return true;
 
-    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
-    if (pParent && !pParent->IsHeader())
+    rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+    if (xParent.is() && !xParent->IsHeader())
     {
-        return pParent->GetHasProtection();
+        return xParent->GetHasProtection();
     }
 
     return false;
@@ -228,9 +228,9 @@ LwpUseWhen* LwpVirtualLayout::GetUseWhen()
     if(GetLayoutType()!=LWP_PAGE_LAYOUT)
     {
         //get parent
-        LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
-        if(pParent && !pParent->IsHeader()&& (pParent->GetLayoutType()!=LWP_PAGE_LAYOUT))
-            return pParent->GetUseWhen();
+        rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+        if (xParent.is() && !xParent->IsHeader() && (xParent->GetLayoutType() != LWP_PAGE_LAYOUT))
+            return xParent->GetUseWhen();
 
     }
 
@@ -318,9 +318,9 @@ bool LwpVirtualLayout::IsMinimumHeight()
 * @descr:   Get parent layout
 *
 */
-LwpVirtualLayout* LwpVirtualLayout::GetParentLayout()
+rtl::Reference<LwpVirtualLayout> LwpVirtualLayout::GetParentLayout()
 {
-    return dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
+    return rtl::Reference<LwpVirtualLayout>(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
 }
 
 /**
@@ -349,9 +349,9 @@ bool LwpVirtualLayout::IsStyleLayout()
     if (m_nAttributes3 & STYLE3_STYLELAYOUT)
         return true;
 
-    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get());
-    if (pParent)
-        return pParent->IsStyleLayout();
+    rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+    if (xParent.is())
+        return xParent->IsStyleLayout();
     return false;
 }
 
@@ -712,10 +712,10 @@ double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide)
     {
         if ( MarginsSameAsParent() )
         {
-            LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
-            if(pParent && !pParent->IsHeader())
+            rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+            if (xParent.is() && !xParent->IsHeader())
             {
-                fValue = pParent->GetMarginsValue(nWhichSide);
+                fValue = xParent->GetMarginsValue(nWhichSide);
                 return fValue;
             }
         }
@@ -1274,16 +1274,16 @@ bool LwpMiddleLayout::HonorProtection()
         if(!(m_nAttributes2 & STYLE2_HONORPROTECTION))
             return false;
 
-        LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
-        if (pParent && !pParent->IsHeader())
+        rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+        if (xParent.is() && !xParent->IsHeader())
         {
-            return pParent->GetHonorProtection();
+            return xParent->GetHonorProtection();
         }
 
         if(m_pFoundry)//is null now
         {
             LwpDocument* pDoc = m_pFoundry->GetDocument();
-            if(pDoc)
+            if (pDoc)
             {
                 return pDoc->GetHonorProtection();
             }
@@ -1323,14 +1323,14 @@ bool LwpMiddleLayout::IsProtected()
             bProtected = LwpVirtualLayout::IsProtected();
     }
 
-    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
-    if(pParent && !pParent->IsHeader())
+    rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+    if (xParent.is() && !xParent->IsHeader())
     {
         /* If a parent's protected then none of its children can be accessed. */
-        if(pParent->GetIsProtected())
+        if (xParent->GetIsProtected())
             return true;
 
-        if(pParent->GetHonorProtection())
+        if (xParent->GetHonorProtection())
             return bProtected;
 
         /* If our parent isn't honoring protection then we aren't protected. */
@@ -1928,7 +1928,7 @@ XFShadow* LwpLayout::GetXFShadow()
  * @descr get the layout that containers the current frame layout
  *
  */
-LwpVirtualLayout* LwpLayout::GetContainerLayout()
+rtl::Reference<LwpVirtualLayout> LwpLayout::GetContainerLayout()
 {
     if(IsRelativeAnchored())
     {
@@ -2091,9 +2091,8 @@ bool LwpPlacableLayout::IsAnchorPage()
     if(IsRelativeAnchored())
         return false;
 
-    LwpVirtualLayout* pLayout = GetParentLayout();
-    if(pLayout && (pLayout->IsPage() || pLayout->IsHeader() || pLayout->IsFooter()))
-    //if(pLayout && pLayout->IsPage())
+    rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
+    if (xLayout.is() && (xLayout->IsPage() || xLayout->IsHeader() || xLayout->IsFooter()))
     {
         return true;
     }
@@ -2108,8 +2107,8 @@ bool LwpPlacableLayout::IsAnchorFrame()
     if(IsRelativeAnchored())
         return false;
 
-    LwpVirtualLayout* pLayout = GetParentLayout();
-    if(pLayout && (pLayout->IsFrame()||pLayout->IsGroupHead()))
+    rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
+    if (xLayout.is() && (xLayout->IsFrame() || xLayout->IsGroupHead()))
     {
         return true;
     }
@@ -2124,8 +2123,8 @@ bool LwpPlacableLayout::IsAnchorCell()
     if(IsRelativeAnchored())
         return false;
 
-    LwpVirtualLayout* pLayout = GetParentLayout();
-    if(pLayout && pLayout->IsCell())
+    rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
+    if (xLayout.is() && xLayout->IsCell())
     {
         return true;
     }
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 5d115a6..a6585c0 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -162,8 +162,8 @@ public:
     bool IsMinimumHeight();
     virtual bool IsForWaterMark(){ return false;}
     virtual LwpPara* GetLastParaOfPreviousStory() { return nullptr; }
-    LwpVirtualLayout* GetParentLayout();
-    virtual LwpVirtualLayout* GetContainerLayout(){ return nullptr;}
+    rtl::Reference<LwpVirtualLayout> GetParentLayout();
+    virtual rtl::Reference<LwpVirtualLayout> GetContainerLayout() { return rtl::Reference<LwpVirtualLayout>(); }
     void RegisterChildStyle();
     bool NoContentReference();
     bool IsStyleLayout();
@@ -418,7 +418,7 @@ public:
     virtual bool IsUseOnAllOddPages() override;
     virtual bool IsUseOnPage() override;
     LwpObjectID& GetPosition(){ return m_Positon;}
-    virtual LwpVirtualLayout* GetContainerLayout() override;
+    virtual rtl::Reference<LwpVirtualLayout> GetContainerLayout() override;
 };
 
 class LwpPlacableLayout : public LwpLayout
diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx
index da8ea33..17ed5c6 100644
--- a/lotuswordpro/source/filter/lwpstory.cxx
+++ b/lotuswordpro/source/filter/lwpstory.cxx
@@ -205,8 +205,8 @@ void LwpStory::SortPageLayout()
         {
             LwpLayout::UseWhenType eSectionType = static_cast<LwpPageLayout*>(xLayout.get())->GetUseWhenType();
             //for mirror page, the child is pagelayout
-            LwpVirtualLayout* pParent = xLayout->GetParentLayout();
-            if(eSectionType != LwpLayout::StartWithinColume && pParent && !pParent->IsPage())
+            rtl::Reference<LwpVirtualLayout> xParent = xLayout->GetParentLayout();
+            if(eSectionType != LwpLayout::StartWithinColume && xParent.is() && !xParent->IsPage())
             {
                 aLayoutList.push_back(static_cast<LwpPageLayout*>(xLayout.get()));
             }
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 85ff885..4efa6a8 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -352,7 +352,7 @@ void LwpSuperTableLayout::ApplyAlignment(XFTableStyle * pTableStyle)
 void  LwpSuperTableLayout::XFConvert(XFContentContainer* pCont)
 {
     if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == GetRelativeType()
-            && (!GetContainerLayout() || !GetContainerLayout()->IsCell()) )
+            && (!GetContainerLayout().is() || !GetContainerLayout()->IsCell()) )
     {
         LwpTableLayout * pTableLayout = GetTableLayout();
         if (pTableLayout)
@@ -720,7 +720,7 @@ void LwpTableLayout::RegisterStyle()
     // If the table is not "with paragraph above" placement, create an frame style
     // by supertable layout
     if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
-        && (!pSuper->GetContainerLayout() || !pSuper->GetContainerLayout()->IsCell()) )
+        && (!pSuper->GetContainerLayout().is() || !pSuper->GetContainerLayout()->IsCell()) )
     {
         //with para above
 //      pSuper->ApplyBackColor(pTableStyle);
diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx
index c92171e..ba6d775 100644
--- a/lotuswordpro/source/filter/lwptoc.cxx
+++ b/lotuswordpro/source/filter/lwptoc.cxx
@@ -243,11 +243,12 @@ void  LwpTocSuperLayout::XFConvert(XFContentContainer* pCont)
     // add TOC content
     LwpSuperTableLayout::XFConvert(pToc);
 
-    if (!GetContainerLayout())
+    rtl::Reference<LwpVirtualLayout> xContainer(GetContainerLayout());
+    if (!xContainer.is())
         return;
 
     // if current TOC is located in a cell, we must add a frame between upper level container and TOC
-    if ( !GetContainerLayout()->IsCell() )
+    if (!xContainer->IsCell())
     {
         pCont->Add(pToc);
     }


More information about the Libreoffice-commits mailing list