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

Caolán McNamara caolanm at redhat.com
Thu Jan 25 13:42:01 UTC 2018


 sw/source/filter/html/swhtml.cxx |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 404a2ff6222228877087233bbe1f2a1544a46d8a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jan 25 10:18:52 2018 +0000

    ofz#4849 Direct leak
    
    Change-Id: If9b7f6de42d99c76165aec775b8cde2505df0c62
    Reviewed-on: https://gerrit.libreoffice.org/48561
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 4115bb6f9e6b..3cb67e703bef 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -674,14 +674,21 @@ void SwHTMLParser::Continue( HtmlTokenId nToken )
                 EndNumBulList();
 
             OSL_ENSURE( !m_nContextStMin, "There are protected contexts" );
-            m_nContextStMin = 0;
-            while( m_aContexts.size() )
+            // try this twice, first normally to let m_nContextStMin decrease
+            // naturally and get contexts popped in desired order, and if that
+            // fails force it
+            for (int i = 0; i < 2; ++i)
             {
-                std::unique_ptr<HTMLAttrContext> xCntxt(PopContext());
-                if (xCntxt)
+                while (m_aContexts.size() > m_nContextStMin)
                 {
-                    EndContext(xCntxt.get());
+                    std::unique_ptr<HTMLAttrContext> xCntxt(PopContext());
+                    if (xCntxt)
+                        EndContext(xCntxt.get());
                 }
+                if (!m_nContextStMin)
+                    break;
+                OSL_ENSURE(!m_nContextStMin, "There are still protected contexts");
+                m_nContextStMin = 0;
             }
 
             if( !m_aParaAttrs.empty() )


More information about the Libreoffice-commits mailing list