Kaydet (Commit) 27b208c5 authored tarafından Michael Meeks's avatar Michael Meeks Kaydeden (comit) Andras Timar

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/49545Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
(cherry picked from commit f215096c)
üst b871f33f
...@@ -1974,6 +1974,19 @@ void cppuhelper::ServiceManager::preloadImplementations() { ...@@ -1974,6 +1974,19 @@ void cppuhelper::ServiceManager::preloadImplementations() {
iterator->second->status = Data::Implementation::STATUS_LOADED; 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 // leak aModule
aModule.release(); aModule.release();
} }
......
...@@ -106,6 +106,7 @@ ...@@ -106,6 +106,7 @@
#include <dwfunctr.hxx> #include <dwfunctr.hxx>
#include <acredlin.hxx> #include <acredlin.hxx>
#include <o3tl/make_unique.hxx> #include <o3tl/make_unique.hxx>
#include <filter.hxx>
#include <scabstdlg.hxx> #include <scabstdlg.hxx>
OUString ScResId(const char* pId) OUString ScResId(const char* pId)
...@@ -266,4 +267,14 @@ void ScDLL::Init() ...@@ -266,4 +267,14 @@ void ScDLL::Init()
// StarOne Services are now handled in the registry // 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -2308,7 +2308,9 @@ ScFormatFilterPlugin &ScFormatFilter::Get() ...@@ -2308,7 +2308,9 @@ ScFormatFilterPlugin &ScFormatFilter::Get()
#ifndef DISABLE_DYNLOADING #ifndef DISABLE_DYNLOADING
OUString sFilterLib(SVLIBRARY("scfilt")); OUString sFilterLib(SVLIBRARY("scfilt"));
static ::osl::Module aModule; static ::osl::Module aModule;
bool bLoaded = aModule.loadRelative(&thisModule, sFilterLib); bool bLoaded = aModule.is();
if (!bLoaded)
bLoaded = aModule.loadRelative(&thisModule, sFilterLib);
if (!bLoaded) if (!bLoaded)
bLoaded = aModule.load(sFilterLib); bLoaded = aModule.load(sFilterLib);
if (bLoaded) if (bLoaded)
......
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
#include <vcl/FilterConfigItem.hxx> #include <vcl/FilterConfigItem.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <o3tl/make_unique.hxx> #include <o3tl/make_unique.hxx>
#include <sdabstdlg.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -289,4 +290,10 @@ void SdDLL::Init() ...@@ -289,4 +290,10 @@ void SdDLL::Init()
#endif #endif
} }
extern "C" SAL_DLLPUBLIC_EXPORT
void lok_preload_hook()
{
SdAbstractDialogFactory::Create();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <swacorr.hxx> #include <swacorr.hxx>
#include <unomid.h> #include <unomid.h>
#include <swabstdlg.hxx>
#include "swdllimpl.hxx" #include "swdllimpl.hxx"
#include <o3tl/make_unique.hxx> #include <o3tl/make_unique.hxx>
...@@ -171,4 +172,10 @@ sw::Filters & SwDLL::getFilters() ...@@ -171,4 +172,10 @@ sw::Filters & SwDLL::getFilters()
return *filters_.get(); return *filters_.get();
} }
extern "C" SAL_DLLPUBLIC_EXPORT
void lok_preload_hook()
{
SwAbstractDialogFactory::Create();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment