diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2018-02-10 17:27:42 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2018-02-11 00:05:57 +0100 |
commit | f215096c24429fe69e7e5ab37898d0f0beeff0ab (patch) | |
tree | df513396a50fc3e6a3282dfba98efd48ed3de270 | |
parent | 273d0ee7b7edb24c2c9e15e9f4337f71c175801a (diff) |
lok: allow libraries to pre-init themselves.
Populate static module references before entering a jail
containing no code.
Implement for scfilt, scui, swui, sdui.
Change-Id: I8fec2aa78e67053a7945926c818122bd4290103c
Reviewed-on: https://gerrit.libreoffice.org/49545
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | cppuhelper/source/servicemanager.cxx | 13 | ||||
-rw-r--r-- | sc/source/ui/app/scdll.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/app/sddll.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/app/swdll.cxx | 7 |
5 files changed, 41 insertions, 1 deletions
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index d51ce6bd6292..014b8ea91817 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -1974,6 +1974,19 @@ void cppuhelper::ServiceManager::preloadImplementations() { iterator->second->status = Data::Implementation::STATUS_LOADED; } + + // Some libraries use other (non-UNO) libraries requiring preinit + oslGenericFunction fpPreload = aModule.getFunctionSymbol( "lok_preload_hook" ); + if (fpPreload) + { + static std::vector<oslGenericFunction> aPreloaded; + if (std::find(aPreloaded.begin(), aPreloaded.end(), fpPreload) == aPreloaded.end()) + { + aPreloaded.push_back(fpPreload); + fpPreload(); + } + } + // leak aModule aModule.release(); } diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 0f398c5d4170..6f8287cd1b9d 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -106,6 +106,7 @@ #include <dwfunctr.hxx> #include <acredlin.hxx> #include <o3tl/make_unique.hxx> +#include <filter.hxx> #include <scabstdlg.hxx> OUString ScResId(const char* pId) @@ -266,4 +267,14 @@ void ScDLL::Init() // StarOne Services are now handled in the registry } +extern "C" SAL_DLLPUBLIC_EXPORT +void lok_preload_hook() +{ + // scfilt + ScFormatFilter::Get(); + // scui + ScAbstractDialogFactory::Create(); +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 3088c50efe29..cd703cbe9714 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2334,7 +2334,9 @@ ScFormatFilterPlugin &ScFormatFilter::Get() #ifndef DISABLE_DYNLOADING OUString sFilterLib(SVLIBRARY("scfilt")); static ::osl::Module aModule; - bool bLoaded = aModule.loadRelative(&thisModule, sFilterLib); + bool bLoaded = aModule.is(); + if (!bLoaded) + bLoaded = aModule.loadRelative(&thisModule, sFilterLib); if (!bLoaded) bLoaded = aModule.load(sFilterLib); if (bLoaded) diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index 16b47899ceea..511b66567d67 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -96,6 +96,7 @@ #include <vcl/FilterConfigItem.hxx> #include <comphelper/processfactory.hxx> #include <o3tl/make_unique.hxx> +#include <sdabstdlg.hxx> using namespace ::com::sun::star; @@ -289,4 +290,10 @@ void SdDLL::Init() #endif } +extern "C" SAL_DLLPUBLIC_EXPORT +void lok_preload_hook() +{ + SdAbstractDialogFactory::Create(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/app/swdll.cxx b/sw/source/uibase/app/swdll.cxx index f1f7b9039d86..7df0cec3a0db 100644 --- a/sw/source/uibase/app/swdll.cxx +++ b/sw/source/uibase/app/swdll.cxx @@ -45,6 +45,7 @@ #include <swacorr.hxx> #include <unomid.h> +#include <swabstdlg.hxx> #include "swdllimpl.hxx" #include <o3tl/make_unique.hxx> @@ -171,4 +172,10 @@ sw::Filters & SwDLL::getFilters() return *filters_.get(); } +extern "C" SAL_DLLPUBLIC_EXPORT +void lok_preload_hook() +{ + SwAbstractDialogFactory::Create(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |