sw/inc/init.hxx | 5 +---- sw/source/filter/basflt/fltini.cxx | 24 ++++++++++++------------ sw/source/uibase/app/swdll.cxx | 3 +++ 3 files changed, 16 insertions(+), 16 deletions(-)
New commits: commit 88906ae23dbe3d8649e459089e9e28b80b758e01 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Jan 21 20:14:01 2025 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed Jan 22 10:03:14 2025 +0100 add loading libmswordlo.so to lok_preload_hook similar to libscfiltlo.so in calc's lok_preload_hook so the module is loaded before any chroot might leave the original libs unavailable to find. Change-Id: I94e88dcd488ba15dc7781078796930e10f32b45c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180560 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/inc/init.hxx b/sw/inc/init.hxx index 438be221de6c..5c6e358c0a01 100644 --- a/sw/inc/init.hxx +++ b/sw/inc/init.hxx @@ -48,11 +48,8 @@ public: ~Filters(); #ifndef DISABLE_DYNLOADING - oslGenericFunction GetMswordLibSymbol( const char *pSymbol ); + static oslGenericFunction GetMswordLibSymbol( const char *pSymbol ); #endif - -private: - osl::Module msword_; }; } diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 6e37bfb1ebb3..744ec4a1379d 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -121,22 +121,22 @@ Filters::~Filters() rEntry.pReader = nullptr; } } - msword_.release(); } #ifndef DISABLE_DYNLOADING oslGenericFunction Filters::GetMswordLibSymbol( const char *pSymbol ) { - if (!msword_.is()) + static ::osl::Module aModule; + if (!aModule.is()) { OUString url(u"$LO_LIB_DIR/" SVLIBRARY("msword") ""_ustr); rtl::Bootstrap::expandMacros(url); - bool ok = msword_.load( url, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ); + bool ok = aModule.load( url, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ); SAL_WARN_IF(!ok, "sw", "failed to load msword library"); } - if (msword_.is()) - return msword_.getFunctionSymbol( OUString::createFromAscii( pSymbol ) ); + if (aModule.is()) + return aModule.getFunctionSymbol( OUString::createFromAscii( pSymbol ) ); return nullptr; } @@ -627,7 +627,7 @@ Reader* GetRTFReader() { #ifndef DISABLE_DYNLOADING - FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportRTF" ) ); + FnGetReader pFunction = reinterpret_cast<FnGetReader>( sw::Filters::GetMswordLibSymbol( "ImportRTF" ) ); if ( pFunction ) return (*pFunction)(); @@ -642,7 +642,7 @@ Reader* GetRTFReader() void GetRTFWriter( std::u16string_view rFltName, const OUString& rBaseURL, WriterRef& xRet ) { #ifndef DISABLE_DYNLOADING - FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportRTF" ) ); + FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( sw::Filters::GetMswordLibSymbol( "ExportRTF" ) ); if ( pFunction ) (*pFunction)( rFltName, rBaseURL, xRet ); @@ -656,7 +656,7 @@ void GetRTFWriter( std::u16string_view rFltName, const OUString& rBaseURL, Write Reader* GetWW8Reader() { #ifndef DISABLE_DYNLOADING - FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOC" ) ); + FnGetReader pFunction = reinterpret_cast<FnGetReader>( sw::Filters::GetMswordLibSymbol( "ImportDOC" ) ); if ( pFunction ) return (*pFunction)(); @@ -670,7 +670,7 @@ Reader* GetWW8Reader() void GetWW8Writer( std::u16string_view rFltName, const OUString& rBaseURL, WriterRef& xRet ) { #ifndef DISABLE_DYNLOADING - FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( SwGlobals::getFilters().GetMswordLibSymbol( "ExportDOC" ) ); + FnGetWriter pFunction = reinterpret_cast<FnGetWriter>( sw::Filters::GetMswordLibSymbol( "ExportDOC" ) ); if ( pFunction ) (*pFunction)( rFltName, rBaseURL, xRet ); @@ -684,7 +684,7 @@ void GetWW8Writer( std::u16string_view rFltName, const OUString& rBaseURL, Write Reader* GetDOCXReader() { #ifndef DISABLE_DYNLOADING - FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOCX" ) ); + FnGetReader pFunction = reinterpret_cast<FnGetReader>( sw::Filters::GetMswordLibSymbol( "ImportDOCX" ) ); if ( pFunction ) return (*pFunction)(); @@ -701,7 +701,7 @@ typedef sal_uInt32 ( *GetSaveWarning )( SfxObjectShell& ); ErrCode SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, bool bSaveInto, const OUString& rStorageName ) { #ifndef DISABLE_DYNLOADING - SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( SwGlobals::getFilters().GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) ); + SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( sw::Filters::GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) ); if( pFunction ) return ErrCode(pFunction( rDoc, rStor, bSaveInto, rStorageName )); return ERRCODE_NONE; @@ -713,7 +713,7 @@ ErrCode SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, bool bSa ErrCode GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ) { #ifndef DISABLE_DYNLOADING - GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( SwGlobals::getFilters().GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) ); + GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( sw::Filters::GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) ); if( pFunction ) return ErrCode(pFunction( rDocS )); return ERRCODE_NONE; diff --git a/sw/source/uibase/app/swdll.cxx b/sw/source/uibase/app/swdll.cxx index a0d0d35773dd..274b0e50c319 100644 --- a/sw/source/uibase/app/swdll.cxx +++ b/sw/source/uibase/app/swdll.cxx @@ -176,6 +176,9 @@ sw::Filters & SwDLL::getFilters() extern "C" SAL_DLLPUBLIC_EXPORT void lok_preload_hook() { + // msword (any symbol will do) + sw::Filters::GetMswordLibSymbol("ImportDOC"); + // swui SwAbstractDialogFactory::Create(); }