diff options
author | Jeremias Maerki <jeremias@apache.org> | 2010-09-16 06:29:08 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2010-09-16 06:29:08 +0000 |
commit | fbb42eee69f7e883606e0ea0e478b55119905f18 (patch) | |
tree | 9275c16d78245fdc59d69788eaf952ac5f63bc4b /src | |
parent | 6784fe6d144dc993462a658e65237c4e37952521 (diff) | |
download | xmlgraphics-fop-fbb42eee69f7e883606e0ea0e478b55119905f18.tar.gz xmlgraphics-fop-fbb42eee69f7e883606e0ea0e478b55119905f18.zip |
Bugzilla #46360:
Fixed a multi-threading issue when rendering SVG.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@997602 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java b/src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java index 41cba7563..839a0cab6 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java +++ b/src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java @@ -23,6 +23,8 @@ import java.awt.Rectangle; import java.awt.geom.AffineTransform; import java.io.IOException; +import org.w3c.dom.Document; + import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.GVTBuilder; import org.apache.batik.gvt.GraphicsNode; @@ -34,6 +36,7 @@ import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; import org.apache.xmlgraphics.ps.PSGenerator; 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.svg.SVGEventProducer; @@ -70,10 +73,14 @@ public class PSImageHandlerSVG implements ImageHandler { context.getUserAgent().getFactory().getImageManager(), context.getUserAgent().getImageSessionContext()); + //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 { GVTBuilder builder = new GVTBuilder(); - root = builder.build(ctx, imageSVG.getDocument()); + root = builder.build(ctx, clonedDoc); } catch (Exception e) { SVGEventProducer eventProducer = SVGEventProducer.Provider.get( context.getUserAgent().getEventBroadcaster()); |