Ignore:
Timestamp:
2012-08-24T13:41:33+02:00 (12 years ago)
Author:
donvip
Message:

[josm_plugins] See #josm7980 - Fix memory leaks in alignways, fixAdresses, measurement, routing, turnlanes and waypoint_search plugins

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingPlugin.java

    r28568 r28624  
    7979         * The side dialog where nodes are listed
    8080         */
    81         private final RoutingDialog routingDialog;
     81        private RoutingDialog routingDialog;
    8282
    8383        /**
     
    147147                logger.debug("Loading routing plugin...");
    148148                preferenceSettings=new RoutingPreferenceDialog();
    149                 // Create side dialog
    150                 routingDialog = new RoutingDialog();
    151149                // Initialize layers list
    152150                layers = new ArrayList<RoutingLayer>();
     
    188186        @Override
    189187        public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) {
    190                 if(newFrame != null) {
     188                if (newFrame != null) {
    191189                        // Create plugin map modes
    192190                        addRouteNodeAction = new AddRouteNodeAction(newFrame);
     
    205203                        // Enable menu
    206204                        menu.enableStartItem();
    207                         newFrame.addToggleDialog(routingDialog);
     205                        newFrame.addToggleDialog(routingDialog = new RoutingDialog());
     206                } else {
     207                        addRouteNodeAction = null;
     208                        removeRouteNodeAction = null;
     209                        moveRouteNodeAction = null;
     210                        addRouteNodeButton = null;
     211                        removeRouteNodeButton = null;
     212                        moveRouteNodeButton = null;
     213                        routingDialog = null;
    208214                }
    209215        }
     
    216222                if (newLayer instanceof RoutingLayer) {                 /*   show Routing toolbar and dialog window  */
    217223                        menu.enableRestOfItems();
    218                         routingDialog.showDialog();
    219                         routingDialog.refresh();
     224                        if (routingDialog != null) {
     225                                routingDialog.showDialog();
     226                                routingDialog.refresh();
     227                        }
    220228                }else{                                                                                  /*   hide Routing toolbar and dialog window  */
    221229                        menu.disableRestOfItems();
    222                         routingDialog.hideDialog();
     230                        if (routingDialog != null) {
     231                                routingDialog.hideDialog();
     232                        }
    223233                }
    224234        }
     
    267277                }
    268278                // Reload RoutingDialog table model
    269                 routingDialog.refresh();
     279                if (routingDialog != null) {
     280                        routingDialog.refresh();
     281                }
    270282        }
    271283
Note: See TracChangeset for help on using the changeset viewer.