[Libreoffice-commits] core.git: 2 commits - lotuswordpro/source sw/qa sw/source

Caolán McNamara caolanm at redhat.com
Wed Jan 31 21:04:18 UTC 2018


 lotuswordpro/source/filter/lwplayout.cxx |   16 ++++------------
 sw/qa/core/data/html/pass/ofz5855-1.html |    1 +
 sw/source/filter/html/htmltab.cxx        |   13 +++++++------
 3 files changed, 12 insertions(+), 18 deletions(-)

New commits:
commit d9efa12addb8fbedbc900081bdcaf9db7fd4cd66
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 31 20:57:37 2018 +0000

    ofz: Infinite loop
    
    Change-Id: I9f7170023dd31c11ef6e02a6901bb5ea18f5fa81

diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 73f0c3114640..c3aae4ee1369 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -484,25 +484,17 @@ void LwpHeadLayout::RegisterStyle()
 {
     //Register all children styles
     rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+    std::set<LwpVirtualLayout*> aSeen;
     while (xLayout.is())
     {
+        aSeen.insert(xLayout.get());
         xLayout->SetFoundry(m_pFoundry);
         //if the layout is relative to para, the layout will be registered in para
         if (!xLayout->IsRelativeAnchored())
-        {
-            if (xLayout.get() == this)
-            {
-                OSL_FAIL("Layout points to itself");
-                break;
-            }
             xLayout->DoRegisterStyle();
-        }
         rtl::Reference<LwpVirtualLayout> xNext(dynamic_cast<LwpVirtualLayout*>(xLayout->GetNext().obj().get()));
-        if (xNext.get() == xLayout.get())
-        {
-            OSL_FAIL("Layout points to itself");
-            break;
-        }
+        if (aSeen.find(xNext.get()) != aSeen.end())
+            throw std::runtime_error("loop in conversion");
         xLayout = xNext;
     }
 }
commit 888973850c7bf476de0b4c9b171d5b19583e8056
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 31 20:41:57 2018 +0000

    ofz#5855 revert fix mem leak
    
    commit 5ceea51947b99f27eb3401bd3c9b8a7cf6ee9c96
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Fri Dec 8 14:13:22 2017 +0000
    
        ofz: fix mem leak
    
        Change-Id: I295e52723297b257dcfe532108471702631ca5f5
        Reviewed-on: https://gerrit.libreoffice.org/46093
    
    Change-Id: I98c2dc7e32c6dfc725a5763077bceb527cb31db2

diff --git a/sw/qa/core/data/html/pass/ofz5855-1.html b/sw/qa/core/data/html/pass/ofz5855-1.html
new file mode 100644
index 000000000000..a24f6cff0431
--- /dev/null
+++ b/sw/qa/core/data/html/pass/ofz5855-1.html
@@ -0,0 +1 @@
+<div title="header"><Table><td><table>ÿ<td></table><style>@page:first</style>
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index b80020e80e8a..680f8c98c95b 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -401,7 +401,7 @@ class HTMLTable
 
     const SwStartNode *m_pPrevStartNode;   // the Table-Node or the Start-Node of the section before
     const SwTable *m_pSwTable;        // SW-Table (only on Top-Level)
-    std::unique_ptr<SwTableBox> m_xBox1;    // TableBox, generated when the Top-Level-Table was build
+    SwTableBox* m_pBox1;                    // TableBox, generated when the Top-Level-Table was build
     SwTableBoxFormat *m_pBoxFormat;         // frame::Frame-Format from SwTableBox
     SwTableLineFormat *m_pLineFormat;       // frame::Frame-Format from SwTableLine
     SwTableLineFormat *m_pLineFrameFormatNoHeight;
@@ -909,7 +909,7 @@ void HTMLTable::InitCtor(const HTMLTableOptions& rOptions)
     m_nRows = 0;
     m_nCurrentRow = 0; m_nCurrentColumn = 0;
 
-    m_xBox1.reset();
+    m_pBox1 = nullptr;
     m_pBoxFormat = nullptr; m_pLineFormat = nullptr;
     m_pLineFrameFormatNoHeight = nullptr;
     m_xInheritedBackgroundBrush.reset();
@@ -1465,11 +1465,12 @@ SwTableBox *HTMLTable::NewTableBox( const SwStartNode *pStNd,
 {
     SwTableBox *pBox;
 
-    if (m_xBox1 && m_xBox1->GetSttNd() == pStNd)
+    if (m_pBox1 && m_pBox1->GetSttNd() == pStNd)
     {
         // If the StartNode is the StartNode of the initially created box, we take that box
-        pBox = const_cast<HTMLTable*>(this)->m_xBox1.release();
+        pBox = const_cast<HTMLTable*>(this)->m_pBox1;
         pBox->SetUpper(pUpper);
+        const_cast<HTMLTable*>(this)->m_pBox1 = nullptr;
     }
     else
         pBox = new SwTableBox( m_pBoxFormat, *pStNd, pUpper );
@@ -2315,11 +2316,11 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
     // get the default line and box format
     // remember the first box and unlist it from the first row
     SwTableLine *pLine1 = (m_pSwTable->GetTabLines())[0];
-    m_xBox1.reset((pLine1->GetTabBoxes())[0]);
+    m_pBox1 = (pLine1->GetTabBoxes())[0];
     pLine1->GetTabBoxes().erase(pLine1->GetTabBoxes().begin());
 
     m_pLineFormat = static_cast<SwTableLineFormat*>(pLine1->GetFrameFormat());
-    m_pBoxFormat = static_cast<SwTableBoxFormat*>(m_xBox1->GetFrameFormat());
+    m_pBoxFormat = static_cast<SwTableBoxFormat*>(m_pBox1->GetFrameFormat());
 
     MakeTable_( pBox );
 


More information about the Libreoffice-commits mailing list