summaryrefslogtreecommitdiff
blob: 4083c94266444aa5ca702e6198e7a15138019db9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
https://gitlab.com/inkscape/inkscape/-/commit/f7857a4fc2b916e64d9689ccc89914ad19f3ef0a.patch
https://bugs.gentoo.org/843275

From f7857a4fc2b916e64d9689ccc89914ad19f3ef0a Mon Sep 17 00:00:00 2001
From: Evangelos Foutras <evangelos@foutrelis.com>
Date: Sun, 20 Mar 2022 22:41:51 -0300
Subject: [PATCH] Ensure compatibility with Poppler 22.03 and later

This change ensures that Inkscape will build against Poppler 22.03 after
the changes that were made to the constructor of `PDFDoc`.

See: https://gitlab.freedesktop.org/poppler/poppler/-/commit/4f2abd3ef

Co-authored-by: Rafael Siejakowski <rs@rs-math.net>
(cherry picked from commit a18c57ffff313fd08bc8a44f6b6bf0b01d7e9b75)
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -668,8 +668,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
 
     // poppler does not use glib g_open. So on win32 we must use unicode call. code was copied from
     // glib gstdio.c
-    GooString *filename_goo = new GooString(uri);
-    pdf_doc = std::make_shared<PDFDoc>(filename_goo, nullptr, nullptr, nullptr);   // TODO: Could ask for password
+    pdf_doc = _POPPLER_MAKE_SHARED_PDFDOC(uri); // TODO: Could ask for password
 
     if (!pdf_doc->isOk()) {
         int error = pdf_doc->getErrorCode();
--- a/src/extension/internal/pdfinput/poppler-transition-api.h
+++ b/src/extension/internal/pdfinput/poppler-transition-api.h
@@ -14,6 +14,12 @@
 
 #include <glib/poppler-features.h>
 
+#if POPPLER_CHECK_VERSION(22, 3, 0)
+#define _POPPLER_MAKE_SHARED_PDFDOC(uri) std::make_shared<PDFDoc>(std::make_unique<GooString>(uri))
+#else
+#define _POPPLER_MAKE_SHARED_PDFDOC(uri) std::make_shared<PDFDoc>(new GooString(uri), nullptr, nullptr, nullptr)
+#endif
+
 #if POPPLER_CHECK_VERSION(0, 83, 0)
 #define _POPPLER_CONST_83 const
 #else
GitLab