vcl/source/window/builder.cxx |   25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

New commits:
commit d0cc12b246e9fd2437b3b87c89d8c4a16ef8c512
Author:     Jan Holesovsky <ke...@collabora.com>
AuthorDate: Fri Oct 4 11:01:31 2019 +0200
Commit:     Jan Holesovsky <ke...@collabora.com>
CommitDate: Mon Oct 7 12:15:04 2019 +0200

    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/80230
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 7ef2e2a13c8f..8e4113aee6da 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -59,8 +59,9 @@
 #include <strings.hrc>
 #include <tools/svlibrary.h>
 #include <tools/diagnose_ex.h>
+#include <comphelper/lok.hxx>
 
-#ifdef DISABLE_DYNLOADING
+#if defined(DISABLE_DYNLOADING) || defined(LINUX)
 #include <dlfcn.h>
 #endif
 
@@ -2153,7 +2154,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
@@ -2177,9 +2179,22 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window 
*pParent, const OString &
                 {
                     pModule.reset(new NoAutoUnloadModule);
                     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));
             }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to