tkormann    02/03/08 07:17:18

  Modified:    sources/org/apache/batik/bridge BridgeEventSupport.java
               sources/org/apache/batik/swing/svg JSVGComponent.java
  Log:
  memory leak hunting - short term fix on BridgeEventSupport.
  
  Remove the code that was supposed to remove event listeners on
  'unload',  because we can not rely on the 'unload' event to remove
  event listeners attached by the bridge.
  
  'unload' are trigerred only if 'onload' is trigerred - it might happen
  sometimes (script error...) that the ScriptCaller are attached and
  'onload' not fired (and that means no 'unload' event fired too - so
  listeners are not removed, and the static HashMap keeps growing!).
  
  Event listeners will be removed after rewrite of a BridgeEventSupport
  (that will also fix the setAttribute("click", "...") issue BTW.
  
  Revision  Changes    Path
  1.27      +5 -3      
xml-batik/sources/org/apache/batik/bridge/BridgeEventSupport.java
  
  Index: BridgeEventSupport.java
  ===================================================================
  RCS file: 
/home/cvs/xml-batik/sources/org/apache/batik/bridge/BridgeEventSupport.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- BridgeEventSupport.java   6 Mar 2002 13:56:25 -0000       1.26
  +++ BridgeEventSupport.java   8 Mar 2002 15:17:18 -0000       1.27
  @@ -54,9 +54,10 @@
    * on the GVT root to propagate GVT events to the DOM.
    * @author <a href="mailto:[EMAIL PROTECTED]>Christophe Jolif</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: BridgeEventSupport.java,v 1.26 2002/03/06 13:56:25 hillion Exp $
  + * @version $Id: BridgeEventSupport.java,v 1.27 2002/03/08 15:17:18 tkormann Exp $
    */
   class BridgeEventSupport implements SVGConstants {
  +
       private static final String[] EVENT_ATTRIBUTES_GRAPHICS = {
           // graphics + svg
           "onfocusin",
  @@ -129,8 +130,7 @@
        * will be added.
        * @param node the <code>GraphicsNode</code>.
        */
  -    public static void addDOMListener(BridgeContext ctx,
  -                                      Element eee) {
  +    public static void addDOMListener(BridgeContext ctx, Element eee) {
           SVGElement element = null;
           EventTarget target = null;
           try {
  @@ -201,6 +201,7 @@
                                           ScriptCaller listener) {
           target.addEventListener(type, listener, false);
           Element svgRoot = ((Element)target).getOwnerDocument().getDocumentElement();
  +        /*
           SVGUnloadListener unload = null;
           if ((unload = SVGUnloadListener.getInstance(svgRoot)) == null)
               ((EventTarget)svgRoot).
  @@ -208,6 +209,7 @@
                                    unload = new SVGUnloadListener(svgRoot),
                                    false);
           unload.addListener(target, type, listener);
  +        */
       }
   
   
  
  
  
  1.46      +9 -1      xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java
  
  Index: JSVGComponent.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- JSVGComponent.java        6 Mar 2002 09:06:39 -0000       1.45
  +++ JSVGComponent.java        8 Mar 2002 15:17:18 -0000       1.46
  @@ -180,7 +180,7 @@
    * building/rendering a document (invalid XML file, missing attributes...).</p>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stephane Hillion</a>
  - * @version $Id: JSVGComponent.java,v 1.45 2002/03/06 09:06:39 vhardy Exp $
  + * @version $Id: JSVGComponent.java,v 1.46 2002/03/08 15:17:18 tkormann Exp $
    */
   public class JSVGComponent extends JGVTComponent {
   
  @@ -988,10 +988,18 @@
               super.gvtRenderingCompleted(e);
   
               if (nextGVTTreeBuilder != null) {
  +                if (nextUpdateManager != null) {
  +                    nextUpdateManager.interrupt();
  +                    nextUpdateManager = null;
  +                }
                   startGVTTreeBuilder();
                   return;
               }
               if (nextDocumentLoader != null) {
  +                if (nextUpdateManager != null) {
  +                    nextUpdateManager.interrupt();
  +                    nextUpdateManager = null;
  +                }
                   startDocumentLoader();
                   return;
               }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to