Author: jeremias
Date: Thu Sep 16 06:26:12 2010
New Revision: 997599

URL: http://svn.apache.org/viewvc?rev=997599&view=rev
Log:
Bugzilla #46360:
Fixed a multi-threading issue when rendering SVG.
Submitted by: Alexis Giotis <alex.giotis.at.gmail.com>

Modified:
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
    xmlgraphics/fop/trunk/status.xml

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java?rev=997599&r1=997598&r2=997599&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
 (original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
 Thu Sep 16 06:26:12 2010
@@ -38,6 +38,7 @@ import org.apache.xmlgraphics.image.load
 
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.image.loader.batik.BatikImageFlavors;
+import org.apache.fop.image.loader.batik.BatikUtil;
 import org.apache.fop.render.ImageHandler;
 import org.apache.fop.render.RenderingContext;
 import org.apache.fop.render.pdf.PDFLogicalStructureHandler.MarkedContentInfo;
@@ -46,6 +47,7 @@ import org.apache.fop.svg.PDFBridgeConte
 import org.apache.fop.svg.PDFGraphics2D;
 import org.apache.fop.svg.SVGEventProducer;
 import org.apache.fop.svg.SVGUserAgent;
+import org.w3c.dom.Document;
 
 /**
  * Image Handler implementation which handles SVG images.
@@ -82,10 +84,14 @@ public class PDFImageHandlerSVG implemen
                 userAgent.getFactory().getImageManager(),
                 userAgent.getImageSessionContext(),
                 new AffineTransform());
+        
+        //Cloning SVG DOM as Batik attaches non-thread-safe facilities (like 
the CSS engine)
+        //to it.
+        Document clonedDoc = 
BatikUtil.cloneSVGDocument(imageSVG.getDocument());
 
         GraphicsNode root;
         try {
-            root = builder.build(ctx, imageSVG.getDocument());
+            root = builder.build(ctx, clonedDoc);
             builder = null;
         } catch (Exception e) {
             SVGEventProducer eventProducer = SVGEventProducer.Provider.get(

Modified: xmlgraphics/fop/trunk/status.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=997599&r1=997598&r2=997599&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Thu Sep 16 06:26:12 2010
@@ -58,6 +58,9 @@
       documents. Example: the fix of marks layering will be such a case when 
it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Renderers" dev="JM" type="fix" fixes-bug="46360" 
due-to="Alexis Giotis">
+        Fixed a multi-threading issue when rendering SVG.
+      </action>
       <action context="Layout" dev="JM" type="fix" fixes-bug="49885">
         Fixed retrieval of available BPD for cases spanning columns and 
multiple pages with differing page masters.
       </action>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to