Remove DrawerVisitor when Frame is deleted. 45/14345/1
Bruno JOFRET [Fri, 4 Apr 2014 14:37:22 +0000 (16:37 +0200)]
Change-Id: Ib6c3e35153ddab33586b0bb6db571bfd4219f19a

scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/DrawerVisitor.java

index 449b79b..05b63dd 100755 (executable)
@@ -179,6 +179,7 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
         this.datatipTextDrawer = new DatatipTextDrawer(canvas.getTextureManager());
 
         visitorMap.put(figure.getIdentifier(), this);
+        //System.err.println("[VisitorMap] size="+visitorMap.size());
     }
 
     public static void changeVisitor(AxesContainer figure, DrawerVisitor visitor) {
@@ -1137,7 +1138,7 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
     @Override
     public void deleteObject(Integer id) {
         Integer type = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
-        if (type == GraphicObjectProperties.__GO_UICONTROL__ || type == GraphicObjectProperties.__GO_UIMENU__) {
+        if (!figure.getIdentifier().equals(id) && type == GraphicObjectProperties.__GO_UICONTROL__ || type == GraphicObjectProperties.__GO_UIMENU__) {
             return; // Not of my managed openGL children
         }