diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2020-05-31 11:50:20 +0200 |
---|---|---|
committer | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2021-04-06 14:43:34 +0300 |
commit | cbecfdcdfbadf189d318c828ce66c46af71e1ded (patch) | |
tree | e73526a897ee8021b285c739f2ce66e9f982c203 | |
parent | 4d54747a206ec7a1a7e7be38be456f89423db2a1 (diff) |
pdfium: only init pdfium library once and destroy on LO exit
With more and more usage of PDFium, it is hard to keep track of
the life-time of the PDFium library, so it can happen that a
FPDF_DestroyLibrary happens when we still have another instance
where PDFium is still use. The result of this is a crash. To
prevent this, just initialize the library once and delete, when
on LO exit.
This can be improved in the future to only keep the library
active when in actual use.
[ Leaving out the vector graphic search bits, the motivation is to just
have this in libreoffice-7-0, so that recent pdf sig verify improvements
can be backported. ]
(cherry picked from commit 067a8a954c8e1d8d6465a4ab5fb61e93f16c26c2)
Conflicts:
vcl/source/graphic/VectorGraphicSearch.cxx
svx/source/svdraw/svdpdf.cxx
svx/source/svdraw/svdpdf.hxx
vcl/Library_vcl.mk
vcl/qa/cppunit/pdfexport/pdfexport.cxx
vcl/source/filter/ipdf/pdfread.cxx
Change-Id: I5c7e5de7f8b97d10efb394c67c7a61b976c8d57c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102317
Tested-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit b7de766b4dc5b4810277069bcf53a9f3737e87da)
-rw-r--r-- | vcl/qa/cppunit/pdfexport/pdfexport.cxx | 3 | ||||
-rw-r--r-- | vcl/source/filter/ipdf/pdfread.cxx | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 343ae06e67da..aa013abc0901 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -205,9 +205,6 @@ void PdfExportTest::setUp() void PdfExportTest::tearDown() { - FPDF_ClosePage(mpPdfPage); - FPDF_CloseDocument(mpPdfDocument); - if (mxComponent.is()) mxComponent->dispose(); diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index fdefe60f9ec5..958df291f964 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -23,6 +23,8 @@ #include <vcl/filter/PDFiumLibrary.hxx> +#include <vcl/filter/PDFiumLibrary.hxx> + using namespace com::sun::star; namespace |