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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 22 13:25:32 UTC 2019


 helpcompiler/inc/HelpCompiler.hxx    |   13 ++++++-------
 helpcompiler/source/HelpCompiler.cxx |    6 ------
 helpcompiler/source/HelpLinker.cxx   |   20 ++++++++++----------
 sw/source/uibase/utlui/content.cxx   |    8 ++------
 4 files changed, 18 insertions(+), 29 deletions(-)

New commits:
commit 252655333ed773585e12378fa3987bb34f38fa38
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Nov 22 10:10:27 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Nov 22 14:24:56 2019 +0100

    Resolves: rhbz#1775544 crash in navigator
    
    see demo reproducer in rhbz#1775544 nChildCount is a count of all
    descendants not just direct children.
    
    Just looping while FirstChild returns something is sufficient.
    
    Change-Id: If7b16032731d694bfffaae22faad5fe194d1822f
    Reviewed-on: https://gerrit.libreoffice.org/83454
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index c651a86df0f3..95091161e3fd 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -2272,12 +2272,8 @@ bool SwContentTree::HasContentChanged()
                     }
                     if(bRemoveChildren)
                     {
-                        for(size_t j = 0; j < nChildCount; ++j)
-                        {
-                            SvTreeListEntry *const pRemove = FirstChild(pEntry);
-                            assert(pRemove);
-                            GetModel()->Remove(pRemove);
-                        }
+                        while (SvTreeListEntry *const pRemove = FirstChild(pEntry))
+                            RemoveEntry(pRemove);
                     }
                     if(!nChildCount)
                     {
commit c5ecf24413625adf9234c67b5da431eb72b3612e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Nov 22 11:09:49 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Nov 22 14:24:32 2019 +0100

    fs::getThreadTextEncoding->osl_getThreadTextEncoding
    
    Change-Id: I803f21dba239073cf07dc853f400adeac3256856
    Reviewed-on: https://gerrit.libreoffice.org/83467
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/helpcompiler/inc/HelpCompiler.hxx b/helpcompiler/inc/HelpCompiler.hxx
index 49a22205cae7..87390aeedc7e 100644
--- a/helpcompiler/inc/HelpCompiler.hxx
+++ b/helpcompiler/inc/HelpCompiler.hxx
@@ -34,6 +34,7 @@
 #include <rtl/character.hxx>
 #include <osl/process.h>
 #include <osl/file.hxx>
+#include <osl/thread.h>
 #include <o3tl/char16_t2wchar_t.hxx>
 
 #include <helpcompiler/compilehelp.hxx>
@@ -47,8 +48,6 @@
 
 namespace fs
 {
-    rtl_TextEncoding getThreadTextEncoding();
-
     enum convert { native };
     class path
     {
@@ -61,20 +60,20 @@ namespace fs
             OUString sWorkingDir;
             osl_getProcessWorkingDir(&sWorkingDir.pData);
             OString tmp(in.c_str());
-            OUString ustrSystemPath(OStringToOUString(tmp, getThreadTextEncoding()));
+            OUString ustrSystemPath(OStringToOUString(tmp, osl_getThreadTextEncoding()));
             osl::File::getFileURLFromSystemPath(ustrSystemPath, data);
             (void)osl::File::getAbsoluteFileURL(sWorkingDir, data, data);
         }
         path(const std::string &FileURL)
         {
             OString tmp(FileURL.c_str());
-            data = OStringToOUString(tmp, getThreadTextEncoding());
+            data = OStringToOUString(tmp, osl_getThreadTextEncoding());
         }
         std::string native_file_string() const
         {
             OUString ustrSystemPath;
             osl::File::getSystemPathFromFileURL(data, ustrSystemPath);
-            OString tmp(OUStringToOString(ustrSystemPath, getThreadTextEncoding()));
+            OString tmp(OUStringToOString(ustrSystemPath, osl_getThreadTextEncoding()));
             HCDBG(std::cerr << "native_file_string is " << tmp.getStr() << std::endl);
             return std::string(tmp.getStr());
         }
@@ -98,7 +97,7 @@ namespace fs
             HCDBG(std::cerr << "orig was " <<
                 OUStringToOString(ret.data, RTL_TEXTENCODING_UTF8).getStr() << std::endl);
             OString tmp(in.c_str());
-            OUString ustrSystemPath(OStringToOUString(tmp, getThreadTextEncoding()));
+            OUString ustrSystemPath(OStringToOUString(tmp, osl_getThreadTextEncoding()));
             ret.data += "/" + ustrSystemPath;
             HCDBG(std::cerr << "final is " <<
                 OUStringToOString(ret.data, RTL_TEXTENCODING_UTF8).getStr() << std::endl);
@@ -107,7 +106,7 @@ namespace fs
         void append(const char *in)
         {
             OString tmp(in);
-            OUString ustrSystemPath(OStringToOUString(tmp, getThreadTextEncoding()));
+            OUString ustrSystemPath(OStringToOUString(tmp, osl_getThreadTextEncoding()));
             data += ustrSystemPath;
         }
         void append(const std::string &in) { append(in.c_str()); }
diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx
index b8a0af737d89..306d2d518067 100644
--- a/helpcompiler/source/HelpCompiler.cxx
+++ b/helpcompiler/source/HelpCompiler.cxx
@@ -491,12 +491,6 @@ void HelpCompiler::compile()
 
 namespace fs
 {
-    rtl_TextEncoding getThreadTextEncoding()
-    {
-        static rtl_TextEncoding nThreadTextEncoding = osl_getThreadTextEncoding();
-        return nThreadTextEncoding;
-    }
-
     void create_directory(const fs::path& indexDirName)
     {
         HCDBG(
diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx
index cad47dad0b08..ecd85044d238 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -73,11 +73,11 @@ static std::string getEncodedPath( const std::string& Path )
 {
     OString aOStr_Path( Path.c_str() );
     OUString aOUStr_Path( OStringToOUString
-        ( aOStr_Path, fs::getThreadTextEncoding() ) );
+        ( aOStr_Path, osl_getThreadTextEncoding() ) );
     OUString aPathURL;
     osl::File::getFileURLFromSystemPath( aOUStr_Path, aPathURL );
     OString aOStr_PathURL( OUStringToOString
-        ( aPathURL, fs::getThreadTextEncoding() ) );
+        ( aPathURL, osl_getThreadTextEncoding() ) );
     std::string aStdStr_PathURL( aOStr_PathURL.getStr() );
     return aStdStr_PathURL;
 }
@@ -748,7 +748,7 @@ void HelpLinker::main( std::vector<std::string> &args,
         OUString aIdxCaptionPathFileURL = *pOfficeHelpPath + "/idxcaption.xsl";
 
         OString aOStr_IdxCaptionPathFileURL( OUStringToOString
-            ( aIdxCaptionPathFileURL, fs::getThreadTextEncoding() ) );
+            ( aIdxCaptionPathFileURL, osl_getThreadTextEncoding() ) );
         std::string aStdStr_IdxCaptionPathFileURL( aOStr_IdxCaptionPathFileURL.getStr() );
 
         idxCaptionStylesheet = fs::path( aStdStr_IdxCaptionPathFileURL );
@@ -772,7 +772,7 @@ void HelpLinker::main( std::vector<std::string> &args,
         OUString aIdxContentPathFileURL = *pOfficeHelpPath + "/idxcontent.xsl";
 
         OString aOStr_IdxContentPathFileURL( OUStringToOString
-            ( aIdxContentPathFileURL, fs::getThreadTextEncoding() ) );
+            ( aIdxContentPathFileURL, osl_getThreadTextEncoding() ) );
         std::string aStdStr_IdxContentPathFileURL( aOStr_IdxContentPathFileURL.getStr() );
 
         idxContentStylesheet = fs::path( aStdStr_IdxContentPathFileURL );
@@ -835,9 +835,9 @@ HelpProcessingErrorInfo& HelpProcessingErrorInfo::operator=( const struct HelpPr
 {
     m_eErrorClass = e.m_eErrorClass;
     OString tmpErrorMsg( e.m_aErrorMsg.c_str() );
-    m_aErrorMsg = OStringToOUString( tmpErrorMsg, fs::getThreadTextEncoding() );
+    m_aErrorMsg = OStringToOUString( tmpErrorMsg, osl_getThreadTextEncoding() );
     OString tmpXMLParsingFile( e.m_aXMLParsingFile.c_str() );
-    m_aXMLParsingFile = OStringToOUString( tmpXMLParsingFile, fs::getThreadTextEncoding() );
+    m_aXMLParsingFile = OStringToOUString( tmpXMLParsingFile, osl_getThreadTextEncoding() );
     m_nXMLParsingLine = e.m_nXMLParsingLine;
     return *this;
 }
@@ -859,21 +859,21 @@ bool compileExtensionHelp
     std::vector<std::string> args;
     args.reserve(nXhpFileCount + 2);
     args.push_back(std::string("-mod"));
-    OString aOExtensionName = OUStringToOString( aExtensionName, fs::getThreadTextEncoding() );
+    OString aOExtensionName = OUStringToOString( aExtensionName, osl_getThreadTextEncoding() );
     args.push_back(std::string(aOExtensionName.getStr()));
 
     for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp )
     {
         OUString aXhpFile = pXhpFiles[iXhp];
 
-        OString aOXhpFile = OUStringToOString( aXhpFile, fs::getThreadTextEncoding() );
+        OString aOXhpFile = OUStringToOString( aXhpFile, osl_getThreadTextEncoding() );
         args.push_back(std::string(aOXhpFile.getStr()));
     }
 
-    OString aOExtensionLanguageRoot = OUStringToOString( aExtensionLanguageRoot, fs::getThreadTextEncoding() );
+    OString aOExtensionLanguageRoot = OUStringToOString( aExtensionLanguageRoot, osl_getThreadTextEncoding() );
     const char* pExtensionPath = aOExtensionLanguageRoot.getStr();
     std::string aStdStrExtensionPath = pExtensionPath;
-    OString aODestination = OUStringToOString(aDestination, fs::getThreadTextEncoding());
+    OString aODestination = OUStringToOString(aDestination, osl_getThreadTextEncoding());
     const char* pDestination = aODestination.getStr();
     std::string aStdStrDestination = pDestination;
 


More information about the Libreoffice-commits mailing list