summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2019-10-04 11:01:31 +0200
committerJan Holesovsky <kendy@collabora.com>2019-12-06 10:18:21 +0100
commit976586021ea04d595d8f53ebf1e1620d9db0dc3b (patch)
tree1bea6c46cb57cb2c04c78501a6ece552cb792468 /vcl
parent9235990b4eacbc8a90750da8bdf2fb15f99a9d79 (diff)
lok preload: Some symbols are in-process when we need them.
But OTOH in the preload case, the libraries we'd otherwise load are not there. An example was libcuilo.so where the instantiation of the spell checking dialog was failing, because it was impossible to find the makeSentenceEditWindow symbol. Change-Id: Ifc0bc5d8b295912728505fe3ce11fa4a0d198124 Reviewed-on: https://gerrit.libreoffice.org/80229 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/builder.cxx31
1 files changed, 24 insertions, 7 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 6f59df71ded5..73782866d904 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -64,8 +64,9 @@
#include <tools/diagnose_ex.h>
#include <wizdlg.hxx>
#include <tools/svlibrary.h>
+#include <comphelper/lok.hxx>
-#ifdef DISABLE_DYNLOADING
+#if defined(DISABLE_DYNLOADING) || defined(LINUX)
#include <dlfcn.h>
#endif
@@ -1668,8 +1669,8 @@ VclBuilder::customMakeWidget GetCustomMakeWidget(const OString& name)
VclBuilder::customMakeWidget pFunction = nullptr;
if (sal_Int32 nDelim = name.indexOf('-'); nDelim != -1)
{
- const OUString sFunction("make"
- + OStringToOUString(name.copy(nDelim + 1), RTL_TEXTENCODING_UTF8));
+ const OString aFunction("make" + name.copy(nDelim + 1));
+ const OUString sFunction(OStringToOUString(aFunction, RTL_TEXTENCODING_UTF8));
#ifndef DISABLE_DYNLOADING
const OUString sModule = SAL_DLLPREFIX
@@ -1690,10 +1691,26 @@ VclBuilder::customMakeWidget GetCustomMakeWidget(const OString& name)
{
pModule.reset(new NoAutoUnloadModule);
bool ok = pModule->loadRelative(&thisModule, sModule);
- assert(ok && "bad module name in .ui");
- (void)ok;
- pFunction = reinterpret_cast<VclBuilder::customMakeWidget>(
- pModule->getFunctionSymbol(sFunction));
+ if (!ok)
+ {
+#ifdef LINUX
+ // in the case of preloading, we don't have eg. the
+ // libcuilo.so, but still need to dlsym the symbols -
+ // which are already in-process
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ pFunction = reinterpret_cast<VclBuilder::customMakeWidget>(dlsym(RTLD_DEFAULT, aFunction.getStr()));
+ ok = !!pFunction;
+ assert(ok && "couldn't even directly dlsym the sFunction (available via preload)");
+ }
+#endif
+ assert(ok && "bad module name in .ui");
+ }
+ else
+ {
+ pFunction = reinterpret_cast<VclBuilder::customMakeWidget>(
+ pModule->getFunctionSymbol(sFunction));
+ }
}
g_aModuleMap.insert(std::make_pair(sModule, pModule));
}