pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1705792 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java
Date Tue, 29 Sep 2015 00:34:50 GMT
Author: jahewson
Date: Tue Sep 29 00:34:50 2015
New Revision: 1705792

URL: http://svn.apache.org/viewvc?rev=1705792&view=rev
Log:
PDFBOX-2370: Don't cache PDImageXObject or PDPattern

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java?rev=1705792&r1=1705791&r2=1705792&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java Tue Sep 29
00:34:50 2015
@@ -27,6 +27,7 @@ import org.apache.pdfbox.pdmodel.common.
 import org.apache.pdfbox.pdmodel.documentinterchange.markedcontent.PDPropertyList;
 import org.apache.pdfbox.pdmodel.font.PDFont;
 import org.apache.pdfbox.pdmodel.font.PDFontFactory;
+import org.apache.pdfbox.pdmodel.graphics.color.PDPattern;
 import org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject;
 import org.apache.pdfbox.pdmodel.graphics.optionalcontent.PDOptionalContentGroup;
 import org.apache.pdfbox.pdmodel.graphics.state.PDExtendedGraphicsState;
@@ -142,8 +143,7 @@ public final class PDResources implement
             PDColorSpace cached = cache.getColorSpace(indirect);
             if (cached != null)
             {
-                // cache disabled due to resource dependency, see PDFBOX-2370
-                //return cached
+                return cached;
             }
         }
 
@@ -159,7 +159,8 @@ public final class PDResources implement
             colorSpace = PDColorSpace.create(name, this);
         }
 
-        if (cache != null)
+        // we can't cache PDPattern, because it holds page resources, see PDFBOX-2370
+        if (cache != null && !(colorSpace instanceof PDPattern))
         {
             cache.put(indirect, colorSpace);
         }
@@ -321,8 +322,7 @@ public final class PDResources implement
             PDXObject cached = cache.getXObject(indirect);
             if (cached != null)
             {
-                // cache disabled due to resource dependency, see PDFBOX-2370
-                //return cached
+                return cached;
             }
         }
 
@@ -342,7 +342,8 @@ public final class PDResources implement
             xobject = PDXObject.createXObject(value, this);
         }
 
-        if (cache != null)
+        // we can't cache PDImageXObject, because it holds page resources, see PDFBOX-2370
+        if (cache != null && !(xobject instanceof PDImageXObject))
         {
             cache.put(indirect, xobject);
         }



Mime
View raw message