vcl/source/window/builder.cxx | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
New commits: commit 976586021ea04d595d8f53ebf1e1620d9db0dc3b Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Fri Oct 4 11:01:31 2019 +0200 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Fri Dec 6 10:18:21 2019 +0100 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 <ke...@collabora.com> 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)); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits