Author: cam
Date: Mon Jan 31 00:24:03 2011
New Revision: 1065441

URL: http://svn.apache.org/viewvc?rev=1065441&view=rev
Log:
Avoid an NPE when unloading a document that had an animation targetting a
CSS property on an element that became display:none.

Modified:
    xmlgraphics/batik/trunk/CHANGES
    
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGStylableElement.java

Modified: xmlgraphics/batik/trunk/CHANGES
URL: 
http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/CHANGES?rev=1065441&r1=1065440&r2=1065441&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/CHANGES (original)
+++ xmlgraphics/batik/trunk/CHANGES Mon Jan 31 00:24:03 2011
@@ -12,7 +12,7 @@ Bug fixing is an on-going task, so it is
     43411, 43847, 43950, 44553, 44590, 44919, 44936, 44966, 45112,
     45114, 45117, 45397, 45520, 45883, 45958, 46072, 46124, 46202,
     46430, 46431, 46855, 46871, 47201, 47202, 48182, 48411, 49889,
-    50006
+    50006, 50100
 
 
 2. New features
@@ -64,6 +64,10 @@ Bug fixing is an on-going task, so it is
   * Avoid an NPE in ttf2svg when resolving substitutions for Arabic script.
   * ttf2svg now correctly writes out kerning pairs for characters that have
     no name.
+  * SVGGraphics2D now serializes font-size values in style="" attributes
+    with a unit.
+  * Avoid an NPE when disposing a document that had animations targetting
+    CSS properties on elements that subsequently became display:none.
 
 5. Misc
 

Modified: 
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGStylableElement.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGStylableElement.java?rev=1065441&r1=1065440&r2=1065441&view=diff
==============================================================================
--- 
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGStylableElement.java
 (original)
+++ 
xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGStylableElement.java
 Mon Jan 31 00:24:03 2011
@@ -226,8 +226,12 @@ public abstract class SVGStylableElement
      */
     public void addTargetListener(String ns, String an, boolean isCSS,
                                   AnimationTargetListener l) {
-        if (isCSS && svgContext != null) {
-            ((SVGAnimationTargetContext) svgContext).addTargetListener(an, l);
+        if (isCSS) {
+            if (svgContext != null) {
+                SVGAnimationTargetContext actx =
+                    (SVGAnimationTargetContext) svgContext;
+                actx.addTargetListener(an, l);
+            }
         } else {
             super.addTargetListener(ns, an, isCSS, l);
         }
@@ -239,7 +243,11 @@ public abstract class SVGStylableElement
     public void removeTargetListener(String ns, String an, boolean isCSS,
                                      AnimationTargetListener l) {
         if (isCSS) {
-            ((SVGAnimationTargetContext)svgContext).removeTargetListener(an, 
l);
+            if (svgContext != null) {
+                SVGAnimationTargetContext actx =
+                    (SVGAnimationTargetContext) svgContext;
+                actx.removeTargetListener(an, l);
+            }
         } else {
             super.removeTargetListener(ns, an, isCSS, l);
         }


Reply via email to