summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2019-10-04 11:01:31 +0200
committerJan Holesovsky <kendy@collabora.com>2019-10-04 16:47:23 +0200
commite4b2c44d846673d26807a8233dfcf96f17ce0d71 (patch)
tree20f4c970e922193aa2a0b2e749141e109b88cb32 /vcl/source
parent9fc6029c9066701b36fc28e32cb540d520b578e2 (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/80223 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/window/builder.cxx25
1 files changed, 20 insertions, 5 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index cdf5307646b8..ba93b26f98e1 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -47,8 +47,9 @@
#include <xmlreader/xmlreader.hxx>
#include <desktop/crashreport.hxx>
#include <strings.hrc>
+#include <comphelper/lok.hxx>
-#ifdef DISABLE_DYNLOADING
+#if defined(DISABLE_DYNLOADING) || defined(LINUX)
#include <dlfcn.h>
#endif
@@ -1670,7 +1671,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
sal_Int32 nDelim = name.indexOf('-');
if (nDelim != -1)
{
- OUString sFunction(OStringToOUString(OString("make") + name.copy(nDelim+1), RTL_TEXTENCODING_UTF8));
+ OString aFunction(OString("make") + name.copy(nDelim+1));
+ OUString sFunction(OStringToOUString(aFunction, RTL_TEXTENCODING_UTF8));
customMakeWidget pFunction = nullptr;
#ifndef DISABLE_DYNLOADING
@@ -1694,9 +1696,22 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
{
pModule.reset(new osl::Module);
bool ok = pModule->loadRelative(&thisModule, sModule);
- assert(ok && "bad module name in .ui");
- (void) ok;
- pFunction = reinterpret_cast<customMakeWidget>(pModule->getFunctionSymbol(sFunction));
+#ifdef LINUX
+ if (!ok && comphelper::LibreOfficeKit::isActive())
+ {
+ // 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
+ pFunction = reinterpret_cast<customMakeWidget>(dlsym(RTLD_DEFAULT, aFunction.getStr()));
+ assert(pFunction && "couldn't even directly dlsym the sFunction (available via preload)");
+ }
+ else
+#endif
+ {
+ assert(ok && "bad module name in .ui");
+ (void) ok;
+ pFunction = reinterpret_cast<customMakeWidget>(pModule->getFunctionSymbol(sFunction));
+ }
}
g_aModuleMap.insert(std::make_pair(sModule, pModule));
}