Ticket #2230: Catch loose threads.2.patch
| File Catch loose threads.2.patch, 2.6 KB (added by , 17 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/MapFrame.java
143 143 144 144 // remove menu entries 145 145 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) {} 146 153 } 147 154 148 155 public Action getDefaultButtonAction() { -
src/org/openstreetmap/josm/gui/MapStatus.java
100 100 ImageLabel distText = new ImageLabel("dist", tr("The length of the new way segment being drawn."), 8); 101 101 102 102 /** 103 * This is the thread that runs in the background and collects the information displayed. 104 * It gets destroyed by MapFrame.java/destroy() when the MapFrame itself is destroyed. 105 */ 106 public Thread thread; 107 108 /** 103 109 * The collector class that waits for notification and then update 104 110 * the display objects. 105 111 * … … 293 299 294 300 // The background thread 295 301 final Collector collector = new Collector(mapFrame); 296 new Thread(collector).start(); 302 thread = new Thread(collector, "Map Status Collector"); 303 thread.setDaemon(true); 304 thread.start(); 297 305 298 306 // Listen to keyboard/mouse events for pressing/releasing alt key and 299 307 // inform the collector. … … 344 352 public String helpTopic() { 345 353 return "Statusline"; 346 354 } 347 355 348 356 @Override 349 357 public void addMouseListener(MouseListener ml) { 350 358 //super.addMouseListener(ml); -
src/org/openstreetmap/josm/tools/XmlObjectParser.java
196 196 } 197 197 198 198 public Iterable<Object> start(final Reader in) { 199 new Thread( ){199 new Thread("XML Reader"){ 200 200 @Override public void run() { 201 201 try { 202 202 SAXParserFactory.newInstance().newSAXParser().parse(new InputSource(in), parser);
