From 716024eb791d9c20c14f4356503bccd37e8b1ef9 Mon Sep 17 00:00:00 2001
From: bartus <szczepaniak.bartek+github@gmail.com>
Date: Mon, 20 Jan 2020 14:52:02 +0100
Subject: [PATCH] Poppler >=0.83 fix.

    Thanks to loqs at
    https://bbs.archlinux.org/viewtopic.php?pid=1883212
---
 OpenBoard.pro            | 1 +
 src/pdf/XPDFRenderer.cpp | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/OpenBoard.pro b/OpenBoard.pro
index e20cf50d..51a3584a 100644
--- a/OpenBoard.pro
+++ b/OpenBoard.pro
@@ -3,6 +3,7 @@ TEMPLATE = app
 
 THIRD_PARTY_PATH=../OpenBoard-ThirdParty
 
+CONFIG += c++14
 CONFIG -= flat
 CONFIG += debug_and_release \
           no_include_pwd
diff --git a/src/pdf/XPDFRenderer.cpp b/src/pdf/XPDFRenderer.cpp
index 583882aa..a77ee49f 100644
--- a/src/pdf/XPDFRenderer.cpp
+++ b/src/pdf/XPDFRenderer.cpp
@@ -48,7 +48,11 @@ XPDFRenderer::XPDFRenderer(const QString &filename, bool importingFile)
     {
         // globalParams must be allocated once and never be deleted
         // note that this is *not* an instance variable of this XPDFRenderer class
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 83
+        globalParams = std::make_unique<GlobalParams>();
+#else
         globalParams = new GlobalParams(0);
+#endif
         globalParams->setupBaseFonts(QFile::encodeName(UBPlatformUtils::applicationResourcesDirectory() + "/" + "fonts").data());
     }
 
@@ -71,8 +75,12 @@ XPDFRenderer::~XPDFRenderer()
 
     if (sInstancesCount.loadAcquire() == 0 && globalParams)
     {
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 83
+        globalParams.reset();
+#else
         delete globalParams;
         globalParams = 0;
+#endif
     }
 }