[poppler] poppler/Catalog.cc poppler/Catalog.h

Albert Astals Cid aacid at kemper.freedesktop.org
Sat May 7 03:12:57 PDT 2011


 poppler/Catalog.cc |   12 +++++-------
 poppler/Catalog.h  |    2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit a7242b78b3c9a64cf38ac150e6a914d7abce3355
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat May 7 11:10:11 2011 +0100

    Do not free a shallow copy of an object we'll free later
    
    Make sure we have our own copy we can free
    Fixes KDE BUG #268816
    (cherry picked from commit dab9cdf795d6caead555326958e86e844ace067b)

diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 2725713..cee88f0 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2005-2010 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2011 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005 Jeff Muizelaar <jrmuizel at nit.ca>
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
 // Copyright (C) 2005 Marco Pesenti Gritti <mpg at redhat.com>
@@ -466,12 +466,10 @@ EmbFile *Catalog::embeddedFile(int i)
 
 GooString *Catalog::getJS(int i)
 {
-  Object obj = getJSNameTree()->getValue(i);
-  if (obj.isRef()) {
-    Ref r = obj.getRef();
-    obj.free();
-    xref->fetch(r.num, r.gen, &obj);
-  }
+  Object obj;
+  // getJSNameTree()->getValue(i) returns a shallow copy of the object so we
+  // do not need to free it
+  getJSNameTree()->getValue(i).fetch(xref, &obj);
 
   if (!obj.isDict()) {
     obj.free();
diff --git a/poppler/Catalog.h b/poppler/Catalog.h
index 405f6ac..7c54753 100644
--- a/poppler/Catalog.h
+++ b/poppler/Catalog.h
@@ -58,7 +58,7 @@ public:
   void parse(Object *tree);
   GBool lookup(GooString *name, Object *obj);
   int numEntries() { return length; };
-  // iterator accessor
+  // iterator accessor, note it returns a shallow copy, do not free the object
   Object getValue(int i);
   GooString *getName(int i);
 


More information about the poppler mailing list