Tommy Andersen created BATIK-1242:
-------------------------------------
Summary: Race condition for UpdateTrack.dirtyNodes from
RunnableQueue and AWT-EventQueue
Key: BATIK-1242
URL: https://issues.apache.org/jira/browse/BATIK-1242
Project: Batik
Issue Type: Bug
Components: GVT
Reporter: Tommy Andersen
When using the JSVGCanvas set to ALWAYS_DYNAMIC, with a loaded SVG document,
that has its style changed externally, the dirtyNodes member of UpdateTracker,
will sometimes clear while within the process of a changeStarted.
When the problem occurs a NullPointerException will be thrown if the race
condition manifests itself within the changeStarted code, in the lines:
{code:java}
boolean doPut = false;
if (dirtyNodes == null) {
dirtyNodes = new HashMap();
doPut = true;
} else if (!dirtyNodes.containsKey(gnWRef))
doPut = true;
if (doPut) {
AffineTransform at = gn.getTransform();
if (at != null) at = (AffineTransform)at.clone();
else at = new AffineTransform();
dirtyNodes.put(gnWRef, at);
}
{code}
When executing the line: dirtyNodes.put(gnWRef, at); the field dirtyNodes is
null. This happens because the RunnableQueue thread calls the clear() method in
between the initialization and put method.
This clear method is called from the UpdateManager class in the repaint method,
in the lines:
{code:java}
List dirtyAreas = updateTracker.getDirtyAreas();
updateTracker.clear();
if (dirtyAreas != null) {
updateRendering(dirtyAreas, false);
}
{code}
Most likely the updateTracker's dirtyNodes section should be a locked resource,
at least within the bounds of changeStarted.
At other times the problem manifests it self in form of a
ConcurrentModificationException spawned from the getDirtyAreas method of
UpdateTracker, as called from above. Here it is the iteration of keys that
cause the problem. Again dirtyNodes should probably be a locked resource within
the confined space of the getDirtyAreas function.
Below is the list of Batik dependencies used in the project where the problem
was seen:
Maven: org.apache.xmlgraphics:batik-anim:1.10
Maven: org.apache.xmlgraphics:batik-awt-util:1.10
Maven: org.apache.xmlgraphics:batik-bridge:1.10
Maven: org.apache.xmlgraphics:batik-constants:1.10
Maven: org.apache.xmlgraphics:batik-css:1.10
Maven: org.apache.xmlgraphics:batik-dom:1.10
Maven: org.apache.xmlgraphics:batik-ext:1.10
Maven: org.apache.xmlgraphics:batik-gui-util:1.9
Maven: org.apache.xmlgraphics:batik-gvt:1.10
Maven: org.apache.xmlgraphics:batik-i18n:1.10
Maven: org.apache.xmlgraphics:batik-parser:1.10
Maven: org.apache.xmlgraphics:batik-script:1.10
Maven: org.apache.xmlgraphics:batik-svg-dom:1.10
Maven: org.apache.xmlgraphics:batik-svggen:1.10
Maven: org.apache.xmlgraphics:batik-swing:1.9
Maven: org.apache.xmlgraphics:batik-transcoder:1.10
Maven: org.apache.xmlgraphics:batik-util:1.10
Maven: org.apache.xmlgraphics:batik-xml:1.10
Maven: org.apache.xmlgraphics:xmlgraphics-commons:2.2
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]