Ticket #2230: Catch loose threads.patch

File Catch loose threads.patch, 2.5 KB (added by xeen, 15 years ago)
  • src/org/openstreetmap/josm/gui/MapFrame.java

     
    143143
    144144        // remove menu entries
    145145        Main.main.menu.viewMenu.setVisible(false);
     146       
     147        // MapFrame gets destroyed when the last layer is removed, but the status line background
     148        // thread that collects the information doesn't get destroyed automatically.
     149        if(statusLine.thread == null) return;
     150        try {
     151            statusLine.thread.interrupt();
     152        } catch (Exception e) {}
    146153    }
    147154
    148155    public Action getDefaultButtonAction() {
  • src/org/openstreetmap/josm/gui/MapStatus.java

     
    9999    ImageLabel headingText = new ImageLabel("heading", tr("The (compass) heading of the line segment being drawn."), 6);
    100100    ImageLabel distText = new ImageLabel("dist", tr("The length of the new way segment being drawn."), 8);
    101101
     102    public Thread thread;
     103   
    102104    /**
    103105     * The collector class that waits for notification and then update
    104106     * the display objects.
     
    293295
    294296        // The background thread
    295297        final Collector collector = new Collector(mapFrame);
    296         new Thread(collector).start();
     298        thread = new Thread(collector, "Map Status Collector");
     299        thread.start();
    297300
    298301        // Listen to keyboard/mouse events for pressing/releasing alt key and
    299302        // inform the collector.
     
    344347    public String helpTopic() {
    345348        return "Statusline";
    346349    }
    347    
     350       
    348351    @Override
    349352    public void addMouseListener(MouseListener ml) {
    350353        //super.addMouseListener(ml);
  • src/org/openstreetmap/josm/tools/XmlObjectParser.java

     
    196196    }
    197197
    198198    public Iterable<Object> start(final Reader in) {
    199         new Thread(){
     199        new Thread("XML Reader"){
    200200            @Override public void run() {
    201201                try {
    202202                    SAXParserFactory.newInstance().newSAXParser().parse(new InputSource(in), parser);