diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-12-13 12:29:29 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-12-13 12:29:29 +0000 |
commit | 1deae8a2d92747ad69b024513ddae93cc8927d29 (patch) | |
tree | 6f0c4b9aede9a1d6c365729c50e6d9b4ac379717 /lotuswordpro | |
parent | guard against missing header rows (diff) | |
download | core-1deae8a2d92747ad69b024513ddae93cc8927d29.tar.gz core-1deae8a2d92747ad69b024513ddae93cc8927d29.zip |
deploy references to keep layout alive long enough
Change-Id: I670f00b0beb77e5014c3dd4a4798e69ece882b87
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.cxx | 10 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwppagelayout.cxx | 30 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.cxx | 5 |
3 files changed, 21 insertions, 24 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index 3e58fa90de8f..e4a9112904ad 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 e7fd45d272db..cd291575967d 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 e5b16c7c7c88..97835316c1c4 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(); |