Author: allain.lalonde
Date: Fri Jul 17 19:36:16 2009
New Revision: 501

Modified:
     
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingCanvas.java
     
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingRepaintManager.java

Log:
Fixed Issue 74; removed the need to track PSwingCanvas.SwingWrapper  
instances in the PSwingRepaintManager, making the memory leak a non-issue

Modified:  
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingCanvas.java
==============================================================================
---  
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingCanvas.java
   
(original)
+++  
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingCanvas.java
   
Fri Jul 17 19:36:16 2009
@@ -66,7 +66,6 @@
              pSwingRepaintManager = new PSwingRepaintManager();
              RepaintManager.setCurrentManager(pSwingRepaintManager);
          }
-        pSwingRepaintManager.addPSwingCanvas(this);
      }

      JComponent getSwingWrapper() {
@@ -81,7 +80,7 @@
          swingWrapper.remove(pSwing.getComponent());
      }

-    private static class SwingWrapper extends JComponent {
+    static class SwingWrapper extends JComponent {
          private PSwingCanvas pSwingCanvas;

          public SwingWrapper(PSwingCanvas pSwingCanvas) {

Modified:  
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingRepaintManager.java
==============================================================================
---  
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingRepaintManager.java
   
(original)
+++  
piccolo2d.java/trunk/extras/src/main/java/edu/umd/cs/piccolox/pswing/PSwingRepaintManager.java
   
Fri Jul 17 19:36:16 2009
@@ -70,7 +70,6 @@
   * @author Sam R. Reid
   */
  public class PSwingRepaintManager extends RepaintManager {
-    private ArrayList swingWrappers = new ArrayList();

      // The components that are currently painting
      // This needs to be a vector for thread safety
@@ -131,7 +130,7 @@
          // need to translate the repaint request since the component may
          // be offset inside another component.
          for (Component comp = c; comp != null && comp.isLightweight()  
&& !captureRepaint; comp = comp.getParent()) {
-            if (swingWrappers.contains(comp.getParent())) {
+            if (comp.getParent() instanceof PSwingCanvas.SwingWrapper) {
                  if (comp instanceof JComponent) {
                      captureRepaint = true;
                      capturedComponent = (JComponent) comp;
@@ -194,9 +193,5 @@
          else {
              super.addInvalidComponent(invalidComponent);
          }
-    }
-
-    void addPSwingCanvas(PSwingCanvas swingWrapper) {
-        swingWrappers.add(swingWrapper.getSwingWrapper());
      }
  }

--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to