[Libreoffice-commits] core.git: include/vcl vcl/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 24 07:56:18 UTC 2021


 include/vcl/filter/PDFiumLibrary.hxx |    4 ++--
 vcl/source/pdf/PDFiumLibrary.cxx     |    6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 32042808aa43b8a45a95ef656987189ec1807f1d
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Feb 23 21:15:28 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Feb 24 08:55:35 2021 +0100

    pdfium: move PDFiumLibrary::get() impl out of the header
    
    Otherwise vcl::pdf::PDFium can't be turned into an interface.
    
    Change-Id: I9e9030e7e7ed36ec1ed777f017c521fa64588e8d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111434
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
index d65658769e84..5bd7e57eec5f 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -228,9 +228,9 @@ public:
     virtual std::vector<unsigned int> getTrailerEnds() = 0;
 };
 
-struct PDFiumLibrary final : public rtl::StaticWithInit<std::shared_ptr<PDFium>, PDFiumLibrary>
+struct VCL_DLLPUBLIC PDFiumLibrary final
 {
-    std::shared_ptr<PDFium> operator()() { return std::make_shared<PDFium>(); }
+    static std::shared_ptr<PDFium>& get();
 };
 
 // Tools
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index 232ed10cb9b6..617ea16cb6eb 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -1307,6 +1307,12 @@ int PDFiumSearchHandleImpl::getSearchResultIndex()
 
 int PDFiumSearchHandleImpl::getSearchCount() { return FPDFText_GetSchCount(mpSearchHandle); }
 
+std::shared_ptr<PDFium>& PDFiumLibrary::get()
+{
+    static auto pInstance = std::make_shared<PDFium>();
+    return pInstance;
+}
+
 } // end vcl::pdf
 
 #endif // HAVE_FEATURE_PDFIUM


More information about the Libreoffice-commits mailing list