[poppler] [PATCH] Allow to build without multithreading

Peter Breitenlohner peb at mppmu.mpg.de
Mon Jun 3 04:37:52 PDT 2013


Hi,

for poppler <= 0.22 it was possible to build libpoppler without
multithreading, but this fails for 0.23.

I know that configure.ac always defines MULTITHREADED and a shared
libpoppler should certainly not be built without it.  For special
situations, e.g., for TeX Live where libpoppler is only used by
luatex/pdftex/xetex to parse pdf files to be included as images, it does
make sense to build a non-shared library without multithreading.

In 0.23.1 there are a few new uses of mutex, not surrounded by
   #if MULTITHREADED ... #endif
the patch below provides these guards:

>From 74f4666083090f4ddb98d4a47de2719fb241790f Mon Sep 17 00:00:00 2001
From: Peter Breitenlohner <peb at mppmu.mpg.de>
Date: Mon, 3 Jun 2013 13:11:01 +0200
Subject: [PATCH] Allow to build without multithreading
To: Albert Astals Cid <aacid at kemper.freedesktop.org>
Cc: poppler at lists.freedesktop.org

Signed-off-by: Peter Breitenlohner <peb at mppmu.mpg.de>
---
  poppler/Annot.cc | 6 ++++++
  poppler/XRef.cc  | 4 ++++
  2 files changed, 10 insertions(+)

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 2713fde..7e2f273 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1543,13 +1543,19 @@ void Annot::incRefCnt() {
  }

  void Annot::decRefCnt() {
+#if MULTITHREADED
    gLockMutex(&mutex);
+#endif
    if (--refCnt == 0) {
+#if MULTITHREADED
      gUnlockMutex(&mutex);
+#endif
      delete this;
      return;
    }
+#if MULTITHREADED
    gUnlockMutex(&mutex);
+#endif
  }

  Annot::~Annot() {
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 85f8a6f..5495b62 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -1252,11 +1252,15 @@ Object *XRef::fetch(int num, int gen, Object *obj, int recursion) {
  }

  void XRef::lock() {
+#if MULTITHREADED
    gLockMutex(&mutex);
+#endif
  }

  void XRef::unlock() {
+#if MULTITHREADED
    gUnlockMutex(&mutex);
+#endif
  }

  Object *XRef::getDocInfo(Object *obj) {
-- 
1.8.2.2



Regards
Peter Breitenlohner <peb at mppmu.mpg.de>


More information about the poppler mailing list