Changeset 28610 in osm


Ignore:
Timestamp:
2012-08-24T01:11:59+02:00 (12 years ago)
Author:
donvip
Message:

[josm_junctionchecking] See #josm7980 - Fix memory leaks

Location:
applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerMapMode.java

    r25501 r28610  
    138138         */
    139139        private void paintRect(Point p1, Point p2) {
    140                 Graphics g = frame.getGraphics();//Main.map.mapView.getGraphics();
    141 
    142                 Rectangle r = oldRect;
    143                 if (r != null) {
    144                         //overwrite old rct
     140                if (frame != null) {
     141                        Graphics g = frame.getGraphics();
     142       
     143                        Rectangle r = oldRect;
     144                        if (r != null) {
     145                                //overwrite old rct
     146                                g.setXORMode(Color.BLACK);
     147                                g.setColor(Color.WHITE);
     148                                g.drawRect(r.x,r.y,r.width,r.height);
     149                        }
     150       
    145151                        g.setXORMode(Color.BLACK);
    146152                        g.setColor(Color.WHITE);
     153                        r = createRect(p1,p2);
    147154                        g.drawRect(r.x,r.y,r.width,r.height);
     155                        oldRect = r;
    148156                }
    149 
    150                 g.setXORMode(Color.BLACK);
    151                 g.setColor(Color.WHITE);
    152                 r = createRect(p1,p2);
    153                 g.drawRect(r.x,r.y,r.width,r.height);
    154                 oldRect = r;
    155157        }
    156158
     
    162164                this.digraph = digraph;
    163165        }
     166
     167        @Override
     168        public void destroy() {
     169                super.destroy();
     170                MapView.removeLayerChangeListener(this);
     171        }
    164172}
  • applications/editors/josm/plugins/junctionchecking/src/org/openstreetmap/josm/plugins/JunctionChecker/JunctionCheckerPlugin.java

    r25501 r28610  
    4949        @Override
    5050        public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
     51                jcMapMode.setFrame(newFrame);
    5152                if (newFrame != null) {
    5253                        junctionCheckDialog = new JunctionCheckDialog(this);
    5354                        newFrame.addToggleDialog(junctionCheckDialog);
    5455                        MapView.addLayerChangeListener(this);
    55                         jcMapMode.setFrame(newFrame);
    5656                } else
    5757                        MapView.removeLayerChangeListener(this);
Note: See TracChangeset for help on using the changeset viewer.