diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2025-01-21 20:14:01 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2025-01-22 10:13:33 +0100 |
commit | ada8e90d565e78031bda313ab14e5411cfe07099 (patch) | |
tree | 351f5b6ac1499be2a93d1e187ef8a99e1171efee | |
parent | d2f81ad28e0cf0e71faa27fdb34d728f28e86d04 (diff) |
add loading libmswordlo.so to lok_preload_hook
cp-24.04.11-4distro/collabora/co-24.04.11
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/+/180559
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | sw/inc/init.hxx | 5 | ||||
-rw-r--r-- | sw/source/filter/basflt/fltini.cxx | 24 | ||||
-rw-r--r-- | sw/source/uibase/app/swdll.cxx | 3 |
3 files changed, 16 insertions, 16 deletions
diff --git a/sw/inc/init.hxx b/sw/inc/init.hxx index b357864109cd..cfb60992c60f 100644 --- a/sw/inc/init.hxx +++ b/sw/inc/init.hxx @@ -46,11 +46,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 9a5b6f0e2c4f..d84ece1cf22d 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("$LO_LIB_DIR/" SVLIBRARY("msword")); 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 c4564a4741f3..60d167b433dd 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(); } |