[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - desktop/source include/vcl vcl/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 4 11:03:38 UTC 2019


 desktop/source/lib/init.cxx         |    3 +++
 include/vcl/graphicfilter.hxx       |    2 ++
 vcl/source/filter/graphicfilter.cxx |   26 ++++++++++++++++++++++++++
 3 files changed, 31 insertions(+)

New commits:
commit b90733fceb9d831a2c796f8ce6b3fffc309f4153
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jul 4 11:57:27 2019 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Jul 4 13:03:00 2019 +0200

    vcl lok: pre-load graphic libraries
    
    This is needed to be able to load e.g. TIFF files in Online, which does
    not have code in the chroot since online.git commit
    ad21717498cc214d5d5d5c0ff378238552137e2f (Avoid copying most code into
    the chroot jail., 2018-03-10).
    
    Conflicts:
            vcl/source/filter/graphicfilter.cxx
    
    Change-Id: Ib095191ee690d9da6269878a82b1c6995df50dfa
    Reviewed-on: https://gerrit.libreoffice.org/75078
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8cfa28881d90..6abda3e775a5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -5171,6 +5171,9 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
                     InitVCL();
                 }
 
+                // pre-load all graphic libraries.
+                GraphicFilter::GetGraphicFilter().preload();
+
                 // pre-load all component libraries.
                 if (!xContext.is())
                     throw css::uno::DeploymentException("preInit: XComponentContext is not created");
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index d84ae3f0a9fa..bb4584e4bf8a 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -304,6 +304,8 @@ public:
 
     ErrCode         compressAsPNG(const Graphic& rGraphic, SvStream& rOutputStream);
 
+    void preload();
+
 private:
     OUString        aFilterPath;
     FilterConfigCache*  pConfig;
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index bef80fb94b24..7448826a8a33 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -66,6 +66,8 @@
 #include <rtl/bootstrap.hxx>
 #include <rtl/instance.hxx>
 #include <vcl/metaact.hxx>
+#include <tools/svlibrary.h>
+#include <comphelper/string.hxx>
 #include <vector>
 #include <memory>
 
@@ -1441,6 +1443,30 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra
     }
 }
 
+void GraphicFilter::preload()
+{
+    sal_Int32 nTokenCount = comphelper::string::getTokenCount(aFilterPath, ';');
+    ImpFilterLibCache& rCache = Cache::get();
+    static const std::initializer_list<OUStringLiteral> aFilterNames = {
+        "icd", "idx", "ime", "ipb", "ipd", "ips", "ipt", "ipx", "ira", "itg", "iti",
+    };
+
+    // Load library for each filter.
+    for (const auto& rFilterName : aFilterNames)
+    {
+        ImpFilterLibCacheEntry* pFilter = nullptr;
+        // Look at the library in each element inside the filter path.
+        for (sal_Int32 i = 0; i < nTokenCount; ++i)
+        {
+            pFilter = rCache.GetFilter(aFilterPath.getToken(i, ';'), SVLIBRARY("gie"), rFilterName);
+            if (pFilter)
+            {
+                break;
+            }
+        }
+    }
+}
+
 ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, SvStream& rIStream,
                                      sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, GraphicFilterImportFlags nImportFlags,
                                      css::uno::Sequence< css::beans::PropertyValue >* pFilterData,


More information about the Libreoffice-commits mailing list