El Dimecres, 3 d'abril de 2013, a les 19:32:23, Albert Astals Cid va escriure:
> El Dimecres, 3 d'abril de 2013, a les 08:00:34, Thomas Freitag va escriure:
> > Am 03.04.2013 00:01, schrieb Albert Astals Cid:
> > > El Dimarts, 2 d'abril de 2013, a les 10:36:53, Thomas Freitag va 
escriure:
> > >> Am 02.04.2013 09:22, schrieb Thomas Freitag:
> > >>> Hi Albert!
> > >>> 
> > >>> Am 27.03.2013 12:29, schrieb Thomas Freitag:
> > >>>> Sorry, pushed the wrong button, here my answer to the list:
> > >>>> 
> > >>>> Am 27.03.2013 11:41, schrieb Albert Astals Cid:
> > >>>>> Why do we pass around the recursion integer around?
> > >>>> 
> > >>>> No idea: The recursive integer wasn't introduced by the thread safe
> > >>>> patch, it was already there. I just used it and extend some functions
> > >>>> which incorrectly ignore that parameter instead of passing it to the
> > >>>> called functions. Probably I missed some more than only the one in
> > >>>> DCTStream::DCTStream.
> > >>> 
> > >>> I just ran a regression test over my PDF files, but I didn't get any
> > >>> dead locks. So if You want me to solve that problem, You should
> > >>> provide me that PDF. (Regardless if You prefer to use recursive mutex:
> > >>> the endless loop detection need to pass the recursive integer
> > >>> everywhere!)
> > >> 
> > >> Attached a patch which corrects it. I made it in my sleep, 'cause the
> > >> dead lock was probably caused by my patch for bug 61994 (even if that
> > >> PDF doesn't cause any dead locks). This time I also respect the
> > >> DCTStream usage if LIBJPEG is disabled :-)
> > > 
> > > Sure, this fixes the issue (and we should commit it to help with the
> > > infinite recursion issue), but what's your opinion on making our mutexes
> > > recursive?
> > 
> > I think, a quite good discussion about recursive and non recursive mutes
> > was here:
> > http://stackoverflow.com/questions/187761/recursive-lock-mutex-vs-non-recu
> > rs ive-lock-mutex. This convinced me to vote for a usage of recursive
> > mutex in poppler: 1. xpdf and therfore poppler wasn't really designed for
> > the usage of threads. We have it now working, but if we cherish on the
> > usage of non recursive mutex we will always run into dead lock problems
> > with futur patches again, so testing patches will become more expensive.
> > 2. Since poppler nowhere uses emergency exits with "throw", we don't
> > have the problem that we have to keep track that a thread releases a
> > mutex so often it aquires it.
> > 3. The only (small) problem I see is the sentence "Not all systems
> > supporting pthreads also support recursive mutexes, but if they want to
> > be POSIX conform, they have to
> > <http://www.opengroup.org/onlinepubs/009695399/functions/pthread_mutexattr
> > _g ettype.html>."
> 
> To be honest i don't think we should care much about the minority of systems
> there that don't support recursive mutexes.

Here's a quick patch I've hacked together (still needs some work in the 
buildsystem side).

I'll finish it properly tomorrow but meanwhile can you guys check if it breaks 
something related to the multithreading side?

I haven't touched the windows side since somewhere i've read that 
CriticalSections are already recursive. Can anyone confirm?

Cheers,
  Albert

> 
> Cheers,
>   Albert
> 
> > Cheers,
> > Thomas
> > 
> > > It should help us making the code simpler since we could just drop all
> > > the
> > > DoNotLockMutex cases, no?
> > > 
> > > Cheers,
> > > 
> > >    Albert
> > >> 
> > >> Cheers,
> > >> Thomas
> > >> 
> > >>> Cheers,
> > >>> Thomas
> > >>> 
> > >>>>> Wouldn't a real recursive mutex be enough?
> > >>>> 
> > >>>> No idea: I used in the thread safe patch just the pthread_lock which
> > >>>> was defined. I'm not knowing what happens when we change it globally
> > >>>> i.e. if it affects other usages of the GooMutex. Just feel free to
> > >>>> change it, You should have the better overview of usages than I have.
> > >>>> 
> > >>>> Cheers,
> > >>>> Thomas
> > >>>> 
> > >>>>> I'm asking because i have a document here (that sadly i can't share)
> > >>>>> that is deadlocking
> > >>>>> itself there because we are not passing the recursion integer
> > >>>>> everywhere (we lose it in DCTStream::DCTStream)
> > >>>>> as shown in this backtrace
> > >>>>> 
> > >>>>> #0  __lll_lock_wait () at
> > >>>>> ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
> > >>>>> #1  0x00007ffff599217c in _L_lock_982 () from
> > >>>>> /lib/x86_64-linux-gnu/libpthread.so.0
> > >>>>> #2  0x00007ffff5991fcb in __GI___pthread_mutex_lock (mutex=0x71dc10)
> > >>>>> at pthread_mutex_lock.c:64
> > >>>>> #3  0x00007ffff5f02f73 in MutexLocker::MutexLocker
> > >>>>> (this=0x7fffffffcfb0, mutexA=0x71dc10, modeA=DoLockMutex) at
> > >>>>> /home/tsdgeos/devel/poppler/goo/GooMutex.h:72
> > >>>>> #4  0x00007ffff5fac8e2 in XRef::fetch (this=0x71db50, num=5, gen=0,
> > >>>>> obj=0x7fffffffd0b0, recursion=0) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/XRef.cc:1137
> > >>>>> #5  0x00007ffff5f8a013 in Object::fetch (this=0x71fe08,
> > >>>>> xref=0x71db50, obj=0x7fffffffd0b0, recursion=0) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Object.cc:122
> > >>>>> #6  0x00007ffff5f19de4 in Dict::lookup (this=0x71fb60,
> > >>>>> key=0x7ffff606fbba "Height", obj=0x7fffffffd0b0, recursion=0) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Dict.cc:256
> > >>>>> #7  0x00007ffff5f032e9 in Object::dictLookup (this=0x7fffffffd5a0,
> > >>>>> key=0x7ffff606fbba "Height", obj=0x7fffffffd0b0, recursion=0) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Object.h:315
> > >>>>> #8  0x00007ffff601f8a3 in DCTStream::DCTStream (this=0x7832b0,
> > >>>>> strA=0x720780, colorXformA=-1, dict=0x7fffffffd5a0) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/DCTStream.cc:72
> > >>>>> #9  0x00007ffff5f9bf6d in Stream::makeFilter (this=0x720780,
> > >>>>> name=0x71fef0 "DCTDecode", str=0x720780, params=0x7fffffffd1e0,
> > >>>>> recursion=1, dict=0x7fffffffd5a0) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Stream.cc:311
> > >>>>> #10 0x00007ffff5f9b71a in Stream::addFilters (this=0x720780,
> > >>>>> dict=0x7fffffffd5a0, recursion=1) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Stream.cc:184
> > >>>>> #11 0x00007ffff5f9204b in Parser::makeStream (this=0x71fcd0,
> > >>>>> dict=0x7fffffffd5a0, fileKey=0x0, encAlgorithm=cryptRC4,
> > >>>>> keyLength=1146103040, objNum=3, objGen=0, recursion=1, strict=false)
> > >>>>> at /home/tsdgeos/devel/poppler/poppler/Parser.cc:280
> > >>>>> #12 0x00007ffff5f918e6 in Parser::getObj (this=0x71fcd0,
> > >>>>> obj=0x7fffffffd5a0, simpleOnly=false, fileKey=0x0,
> > >>>>> encAlgorithm=cryptRC4, keyLength=1146103040, objNum=3, objGen=0,
> > >>>>> recursion=0, strict=false) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Parser.cc:131
> > >>>>> #13 0x00007ffff5facdd3 in XRef::fetch (this=0x71db50, num=3, gen=0,
> > >>>>> obj=0x7fffffffd5a0, recursion=0) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/XRef.cc:1197
> > >>>>> #14 0x00007ffff5f8a013 in Object::fetch (this=0x71e128,
> > >>>>> xref=0x71db50, obj=0x7fffffffd5a0, recursion=0) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Object.cc:122
> > >>>>> #15 0x00007ffff5f19de4 in Dict::lookup (this=0x71e660, key=0x7206e0
> > >>>>> "Im1", obj=0x7fffffffd5a0, recursion=0) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Dict.cc:256
> > >>>>> #16 0x00007ffff5f032e9 in Object::dictLookup (this=0x71e598,
> > >>>>> key=0x7206e0 "Im1", obj=0x7fffffffd5a0, recursion=0) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Object.h:315
> > >>>>> #17 0x00007ffff5f2a647 in GfxResources::lookupXObject
> > >>>>> (this=0x71e590, name=0x7206e0 "Im1", obj=0x7fffffffd5a0) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Gfx.cc:411
> > >>>>> #18 0x00007ffff5f3f41e in Gfx::opXObject (this=0x71e440,
> > >>>>> args=0x7fffffffd720, numArgs=1) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Gfx.cc:4114
> > >>>>> #19 0x00007ffff5f2bfd6 in Gfx::execOp (this=0x71e440,
> > >>>>> cmd=0x7fffffffd6e0, args=0x7fffffffd720, numArgs=1) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Gfx.cc:858
> > >>>>> #20 0x00007ffff5f2b82b in Gfx::go (this=0x71e440, topLevel=true) at
> > >>>>> /home/tsdgeos/devel/poppler/poppler/Gfx.cc:717
> > >>>>> 
> > >>>>> 
> > >>>>> Cheers,
> > >>>>> 
> > >>>>>     Albert
> > >>>>> 
> > >>>>> _______________________________________________
> > >>>>> poppler mailing list
> > >>>>> [email protected]
> > >>>>> http://lists.freedesktop.org/mailman/listinfo/poppler
> > >>>>> 
> > >>>>> .
> > >>>> 
> > >>>> _______________________________________________
> > >>>> poppler mailing list
> > >>>> [email protected]
> > >>>> http://lists.freedesktop.org/mailman/listinfo/poppler
> > >>>> 
> > >>>> .
> > >>> 
> > >>> _______________________________________________
> > >>> poppler mailing list
> > >>> [email protected]
> > >>> http://lists.freedesktop.org/mailman/listinfo/poppler
> > >>> 
> > >>> .
> > > 
> > > _______________________________________________
> > > poppler mailing list
> > > [email protected]
> > > http://lists.freedesktop.org/mailman/listinfo/poppler
> > > 
> > > .
> 
> _______________________________________________
> poppler mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/poppler
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4643ae0..4c333d8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -397,7 +397,7 @@ else(MSVC)
 add_library(poppler SHARED ${poppler_SRCS})
 endif(MSVC)
 set_target_properties(poppler PROPERTIES VERSION 35.0.0 SOVERSION 35)
-target_link_libraries(poppler ${poppler_LIBS})
+target_link_libraries(poppler ${poppler_LIBS} -lpthread)
 target_link_libraries(poppler LINK_INTERFACE_LIBRARIES "")
 install(TARGETS poppler RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
 
diff --git a/goo/GooMutex.h b/goo/GooMutex.h
index 591a7d4..83a370c 100644
--- a/goo/GooMutex.h
+++ b/goo/GooMutex.h
@@ -53,28 +53,35 @@ typedef CRITICAL_SECTION GooMutex;
 
 #include <pthread.h>
 
-typedef pthread_mutex_t GooMutex;
-
-#define gInitMutex(m) pthread_mutex_init(m, NULL)
-#define gDestroyMutex(m) pthread_mutex_destroy(m)
-#define gLockMutex(m) pthread_mutex_lock(m)
-#define gUnlockMutex(m) pthread_mutex_unlock(m)
+typedef struct {
+  pthread_mutexattr_t attributes;
+  pthread_mutex_t mutex;
+} GooMutex;
+
+inline void gInitMutex(GooMutex *m) {
+  pthread_mutexattr_init(&m->attributes);
+  pthread_mutexattr_settype(&m->attributes, PTHREAD_MUTEX_RECURSIVE);
+  pthread_mutex_init(&m->mutex, &m->attributes);
+}
+inline void gDestroyMutex(GooMutex *m) {
+  pthread_mutex_destroy(&m->mutex);
+}
+inline void gLockMutex(GooMutex *m) {
+  pthread_mutex_lock(&m->mutex);
+}
+inline void gUnlockMutex(GooMutex *m) {
+  pthread_mutex_unlock(&m->mutex);
+}
 
 #endif
 
-enum MutexLockMode {
-  DoNotLockMutex,  // for conditional locks: do not lock 
-  DoLockMutex      // for conditional locks: do lock 
-};
-
 class MutexLocker {
 public:
-  MutexLocker(GooMutex *mutexA, MutexLockMode modeA = DoLockMutex) : mutex(mutexA), mode(modeA) { if (mode == DoLockMutex) gLockMutex(mutex); }
-  ~MutexLocker() { if (mode == DoLockMutex) gUnlockMutex(mutex); }
+  MutexLocker(GooMutex *mutexA) : mutex(mutexA) { gLockMutex(mutex); }
+  ~MutexLocker() { gUnlockMutex(mutex); }
 
 private:
   GooMutex *mutex;
-  const MutexLockMode mode;
 };
 
 #endif
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index f1181a7..2713fde 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1213,7 +1213,7 @@ void Annot::initialize(PDFDoc *docA, Dict *dict) {
   if (dict->lookupNF("P", &obj1)->isRef()) {
     Ref ref = obj1.getRef();
 
-    page = doc->getCatalog()->findPage (ref.num, ref.gen, DoNotLockMutex);
+    page = doc->getCatalog()->findPage (ref.num, ref.gen);
   } else {
     page = 0;
   }
@@ -1350,8 +1350,8 @@ GBool Annot::inRect(double x, double y) const {
   return rect->contains(x, y);
 }
 
-void Annot::update(const char *key, Object *value, MutexLockMode lock) {
-  annotCondLocker(lock);
+void Annot::update(const char *key, Object *value) {
+  annotLocker();
   /* Set M to current time, unless we are updating M itself */
   if (strcmp(key, "M") != 0) {
     delete modified;
@@ -1384,7 +1384,7 @@ void Annot::setContents(GooString *new_content) {
   
   Object obj1;
   obj1.initString(contents->copy());
-  update ("Contents", &obj1, DoNotLockMutex);
+  update ("Contents", &obj1);
 }
 
 void Annot::setName(GooString *new_name) {
@@ -1399,7 +1399,7 @@ void Annot::setName(GooString *new_name) {
 
   Object obj1;
   obj1.initString(name->copy());
-  update ("NM", &obj1, DoNotLockMutex);
+  update ("NM", &obj1);
 }
 
 void Annot::setModified(GooString *new_modified) {
@@ -1413,7 +1413,7 @@ void Annot::setModified(GooString *new_modified) {
 
   Object obj1;
   obj1.initString(modified->copy());
-  update ("M", &obj1, DoNotLockMutex);
+  update ("M", &obj1);
 }
 
 void Annot::setFlags(Guint new_flags) {
@@ -1421,7 +1421,7 @@ void Annot::setFlags(Guint new_flags) {
   Object obj1;
   flags = new_flags;
   obj1.initInt(flags);
-  update ("F", &obj1, DoNotLockMutex);
+  update ("F", &obj1);
 }
 
 void Annot::setBorder(AnnotBorderArray *new_border) {
@@ -1431,7 +1431,7 @@ void Annot::setBorder(AnnotBorderArray *new_border) {
   if (new_border) {
     Object obj1;
     new_border->writeToObject(xref, &obj1);
-    update ("Border", &obj1, DoNotLockMutex);
+    update ("Border", &obj1);
     border = new_border;
   } else {
     border = NULL;
@@ -1445,7 +1445,7 @@ void Annot::setColor(AnnotColor *new_color) {
   if (new_color) {
     Object obj1;
     new_color->writeToObject(xref, &obj1);
-    update ("C", &obj1, DoNotLockMutex);
+    update ("C", &obj1);
     color = new_color;
   } else {
     color = NULL;
@@ -1467,12 +1467,12 @@ void Annot::setPage(int pageIndex, GBool updateP) {
   }
 
   if (updateP) {
-    update("P", &obj1, DoNotLockMutex);
+    update("P", &obj1);
   }
 }
 
-void Annot::setAppearanceState(const char *state, MutexLockMode lock) {
-  annotCondLocker(lock);
+void Annot::setAppearanceState(const char *state) {
+  annotLocker();
   if (!state)
     return;
 
@@ -1484,7 +1484,7 @@ void Annot::setAppearanceState(const char *state, MutexLockMode lock) {
 
   Object obj1;
   obj1.initName(state);
-  update ("AS", &obj1, DoNotLockMutex);
+  update ("AS", &obj1);
 
   // The appearance state determines the current appearance stream
   appearance.free();
@@ -1503,12 +1503,12 @@ void Annot::invalidateAppearance() {
   delete appearStreams;
   appearStreams = NULL;
 
-  setAppearanceState("Off", DoNotLockMutex); // Default appearance state
+  setAppearanceState("Off"); // Default appearance state
 
   Object obj1;
   obj1.initNull();
-  update ("AP", &obj1, DoNotLockMutex); // Remove AP
-  update ("AS", &obj1, DoNotLockMutex); // Remove AS
+  update ("AP", &obj1); // Remove AP
+  update ("AS", &obj1); // Remove AS
 }
 
 double Annot::getXMin() {
@@ -3813,7 +3813,7 @@ AnnotWidget::~AnnotWidget() {
 void AnnotWidget::initialize(PDFDoc *docA, Dict *dict) {
   Object obj1;
 
-  form = doc->getCatalog()->getForm(DoNotLockMutex);
+  form = doc->getCatalog()->getForm();
 
   if(dict->lookup("H", &obj1)->isName()) {
     const char *modeName = obj1.getName();
diff --git a/poppler/Annot.h b/poppler/Annot.h
index 7bc76b7..7be2114 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -572,7 +572,7 @@ public:
   // new_color. 
   void setColor(AnnotColor *new_color);
 
-  void setAppearanceState(const char *state, MutexLockMode lock = DoLockMutex);
+  void setAppearanceState(const char *state);
 
   // Delete appearance streams and reset appearance state
   void invalidateAppearance();
@@ -627,7 +627,7 @@ protected:
 
   // Updates the field key of the annotation dictionary
   // and sets M to the current time
-  void update(const char *key, Object *value, MutexLockMode lock = DoLockMutex);
+  void update(const char *key, Object *value);
 
   int refCnt;
 
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 9c5fb71..f49049a 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -58,10 +58,8 @@
 
 #if MULTITHREADED
 #  define catalogLocker()   MutexLocker locker(&mutex)
-#  define catalogCondLocker(X)  MutexLocker locker(&mutex, (X))
 #else
 #  define catalogLocker()
-#  define catalogCondLocker(X)
 #endif
 //------------------------------------------------------------------------
 // Catalog
@@ -234,11 +232,11 @@ Page *Catalog::getPage(int i)
   return pages[i-1];
 }
 
-Ref *Catalog::getPageRef(int i, MutexLockMode lock)
+Ref *Catalog::getPageRef(int i)
 {
   if (i < 1) return NULL;
 
-  catalogCondLocker(lock);
+  catalogLocker();
   if (i > lastCachedPage) {
      GBool cached = cachePageTree(i);
      if ( cached == gFalse) {
@@ -294,7 +292,7 @@ GBool Catalog::cachePageTree(int page)
       return gFalse;
     }
 
-    pagesSize = getNumPages(DoNotLockMutex);
+    pagesSize = getNumPages();
     pages = (Page **)gmallocn(pagesSize, sizeof(Page *));
     pageRefs = (Ref *)gmallocn(pagesSize, sizeof(Ref));
     for (int i = 0; i < pagesSize; ++i) {
@@ -421,11 +419,11 @@ GBool Catalog::cachePageTree(int page)
   return gFalse;
 }
 
-int Catalog::findPage(int num, int gen, MutexLockMode lock) {
+int Catalog::findPage(int num, int gen) {
   int i;
 
-  for (i = 0; i < getNumPages(lock); ++i) {
-    Ref *ref = getPageRef(i+1, lock);
+  for (i = 0; i < getNumPages(); ++i) {
+    Ref *ref = getPageRef(i+1);
     if (ref != NULL && ref->num == num && ref->gen == gen)
       return i + 1;
   }
@@ -772,9 +770,9 @@ GBool Catalog::indexToLabel(int index, GooString *label)
   }
 }
 
-int Catalog::getNumPages(MutexLockMode lock)
+int Catalog::getNumPages()
 {
-  catalogCondLocker((numPages == -1 && lock == DoLockMutex) ? DoLockMutex : DoNotLockMutex);
+  catalogLocker();
   if (numPages == -1)
   {
     Object catDict, pagesDict, obj;
@@ -829,7 +827,7 @@ PageLabelInfo *Catalog::getPageLabelInfo()
     }
 
     if (catDict.dictLookup("PageLabels", &obj)->isDict()) {
-      pageLabelInfo = new PageLabelInfo(&obj, getNumPages(DoNotLockMutex));
+      pageLabelInfo = new PageLabelInfo(&obj, getNumPages());
     }
     obj.free();
     catDict.free();
@@ -916,9 +914,9 @@ Catalog::FormType Catalog::getFormType()
   return res;
 }
 
-Form *Catalog::getForm(MutexLockMode lock)
+Form *Catalog::getForm()
 {
-  catalogCondLocker(lock);
+  catalogLocker();
   if (!form) {
     if (acroForm.isDict()) {
       form = new Form(doc, &acroForm);
diff --git a/poppler/Catalog.h b/poppler/Catalog.h
index 4ee7bc9..24a3dcf 100644
--- a/poppler/Catalog.h
+++ b/poppler/Catalog.h
@@ -107,13 +107,13 @@ public:
   GBool isOk() { return ok; }
 
   // Get number of pages.
-  int getNumPages(MutexLockMode lock = DoLockMutex);
+  int getNumPages();
 
   // Get a page.
   Page *getPage(int i);
 
   // Get the reference for a page object.
-  Ref *getPageRef(int i, MutexLockMode lock = DoLockMutex);
+  Ref *getPageRef(int i);
 
   // Return base URI, or NULL if none.
   GooString *getBaseURI() { return baseURI; }
@@ -127,7 +127,7 @@ public:
 
   // Find a page, given its object ID.  Returns page number, or 0 if
   // not found.
-  int findPage(int num, int gen, MutexLockMode lock = DoLockMutex);
+  int findPage(int num, int gen);
 
   // Find a named destination.  Returns the link destination, or
   // NULL if <name> is not a destination.
@@ -165,7 +165,7 @@ public:
   };
 
   FormType getFormType();
-  Form* getForm(MutexLockMode lock = DoLockMutex);
+  Form* getForm();
 
   ViewerPreferences *getViewerPreferences();
 
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 109917a..81ca9b1 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -1134,7 +1134,7 @@ Object *XRef::fetch(int num, int gen, Object *obj, int recursion) {
   Parser *parser;
   Object obj1, obj2, obj3;
 
-  xrefCondLocker((recursion == 0) ? DoLockMutex : DoNotLockMutex);
+  xrefLocker();
   // check for bogus ref - this can happen in corrupted PDF files
   if (num < 0 || num >= size) {
     goto err;
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 06378bd..43e0e68 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -32,7 +32,7 @@ if (HAVE_CAIRO)
   )
   add_definitions(${CAIRO_CFLAGS})
   add_executable(pdftocairo ${pdftocairo_SOURCES})
-  target_link_libraries(pdftocairo ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARIES} ${common_libs})
+  target_link_libraries(pdftocairo ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARIES} ${common_libs}  -lpthread)
   if(LCMS_FOUND)
     target_link_libraries(pdftocairo ${LCMS_LIBRARIES})
   endif(LCMS_FOUND)
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to