Issue #2925 - added runAsync dispose checks.
Change-Id: I4048f4b4ae8976d93b1bee89179be527ee3139e5 Former-commit-id:43cfdc587a
[formerly112f7a886e
] [formerly43cfdc587a
[formerly112f7a886e
] [formerly397cb233d4
[formerly 2ebffdcfca606309daa3ed587f696a95af0b094e]]] Former-commit-id:397cb233d4
Former-commit-id:30f7cac193
[formerly2a6f9e8a85
] Former-commit-id:60f93fef09
This commit is contained in:
parent
51eda792e5
commit
bf055bee25
6 changed files with 82 additions and 52 deletions
|
@ -88,6 +88,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* 04/08/2012 1229 rferrel Made dialog non-blocking.
|
||||
* 10/15/2012 1229 rferrel Changes for non-blocking HelpUsageDlg.
|
||||
* 16 Aug 2013 #2256 lvenable Fixed image and cursor memory leaks.
|
||||
* 19Mar2014 #2925 lvenable Added dispose checks for runAsync.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -830,14 +831,16 @@ public class CigVisDistributionDlg extends CaveSWTDialog implements
|
|||
}
|
||||
}
|
||||
|
||||
if (isDisposed() == false) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setBusyCursor(false);
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isDisposed()) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setBusyCursor(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -895,6 +898,10 @@ public class CigVisDistributionDlg extends CaveSWTDialog implements
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
if (isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
((ICigVisTabComp) byMonthTab.getControl())
|
||||
.setCigVisData(data);
|
||||
((ICigVisTabComp) byHourTab.getControl())
|
||||
|
|
|
@ -47,9 +47,10 @@ import com.raytheon.viz.aviation.monitor.AvnPyUtil;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 5, 2009 avarani Initial creation
|
||||
* Mar 31,2011 8774 rferrel killProcess when doing a disposed
|
||||
* Apr 4, 2011 8896 rferrel Made timeout configurable
|
||||
* Oct 5, 2009 avarani Initial creation
|
||||
* Mar 31,2011 8774 rferrel killProcess when doing a disposed
|
||||
* Apr 4, 2011 8896 rferrel Made timeout configurable
|
||||
* 19Mar2014 #2925 lvenable Added dispose checks for runAsync.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -196,15 +197,16 @@ public class CigVisTrendDataManager implements PyProcessListener {
|
|||
pythonScript = null;
|
||||
}
|
||||
}
|
||||
if (CigVisTrendDataManager.this.parent.isDisposed() == false) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (CigVisTrendDataManager.this.parent.isDisposed() == false) {
|
||||
CigVisTrendDataManager.this.parent
|
||||
.resetCursor();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -256,7 +258,9 @@ public class CigVisTrendDataManager implements PyProcessListener {
|
|||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
parent.dataReceived();
|
||||
if (parent.isDisposed() == false) {
|
||||
parent.dataReceived();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* 10/15/2012 1229 rferrel Changes for non-blocking HelpUsageDlg.
|
||||
* 11/26/2012 1298 rferrel Non-blocking dialog code cleanup.
|
||||
* 12 Aug 2013 #2256 lvenable Disposed of masterImage.
|
||||
* 19Mar2014 #2925 lvenable Added dispose checks for runAsync.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -723,21 +724,24 @@ public class WeatherPlotDialog extends CaveSWTDialog {
|
|||
@Override
|
||||
public void run() {
|
||||
dataMgr.loadCacheData(siteId);
|
||||
if (isDisposed() == false) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (dataMgr.loadData(siteId, currentTime)) {
|
||||
updateSiteTimeLabel();
|
||||
displayData();
|
||||
} else {
|
||||
// Something cleared the cache try again.
|
||||
populateData();
|
||||
}
|
||||
setCursorBusy(false);
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isDisposed()) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (dataMgr.loadData(siteId, currentTime)) {
|
||||
updateSiteTimeLabel();
|
||||
displayData();
|
||||
} else {
|
||||
// Something cleared the cache try again.
|
||||
populateData();
|
||||
}
|
||||
setCursorBusy(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
|
|
|
@ -64,6 +64,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
* 3/31/2011 8774 rferrel killProcess when doing a disposed
|
||||
* 4/4/2011 8896 rferrel Made timeout configurable
|
||||
* 3/9/2012 14530 zhao Revised wind rose plot to match AWIPS-1
|
||||
* 19Mar2014 #2925 lvenable Added dispose checks for runAsync and cleaned up code.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -77,7 +78,7 @@ public class WindRoseDataMgr implements PyProcessListener {
|
|||
|
||||
private static WindRoseDataMgr instance = null;
|
||||
|
||||
private static WindRoseCanvasComp canvas;
|
||||
private WindRoseCanvasComp canvas;
|
||||
|
||||
private String siteId;
|
||||
|
||||
|
@ -246,12 +247,12 @@ public class WindRoseDataMgr implements PyProcessListener {
|
|||
final int flightCat, final String site, WindRoseCanvasComp canvas) {
|
||||
final int timeout = ClimateTimeoutManager.getInstance()
|
||||
.getWindRoseTimeout();
|
||||
WindRoseDataMgr.canvas = canvas;
|
||||
this.canvas = canvas;
|
||||
|
||||
if (site.equals(siteId) && (Integer.parseInt(monthStr) == month)
|
||||
&& (Integer.parseInt(numMonths) == this.numMonths)
|
||||
&& flightCat == this.flightCat) {
|
||||
WindRoseDataMgr.canvas.resetCursor();
|
||||
this.canvas.resetCursor();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -315,14 +316,14 @@ public class WindRoseDataMgr implements PyProcessListener {
|
|||
}
|
||||
}
|
||||
|
||||
if (WindRoseDataMgr.canvas.isDisposed() == false) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
WindRoseDataMgr.canvas.resetCursor();
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (WindRoseDataMgr.this.canvas.isDisposed() == false) {
|
||||
WindRoseDataMgr.this.canvas.resetCursor();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -554,7 +555,7 @@ public class WindRoseDataMgr implements PyProcessListener {
|
|||
}
|
||||
|
||||
for (int i = 0; i < dblArray.length; ++i) {
|
||||
dblArray[i] = (dblArray[i] / totalCount) * 100;
|
||||
dblArray[i] = (dblArray[i] / totalCount) * 100;
|
||||
}
|
||||
|
||||
return dblArray;
|
||||
|
@ -567,7 +568,7 @@ public class WindRoseDataMgr implements PyProcessListener {
|
|||
*/
|
||||
public double getTotalWindDirCount() {
|
||||
int total = 0;
|
||||
|
||||
|
||||
for (int x = hour; x < (hour + numHours); ++x) {
|
||||
int h = x;
|
||||
if (h >= 24) {
|
||||
|
@ -622,10 +623,11 @@ public class WindRoseDataMgr implements PyProcessListener {
|
|||
|
||||
public void printData(String filename) {
|
||||
File file = new File(filename);
|
||||
FileWriter writer;
|
||||
FileWriter writer = null;
|
||||
BufferedWriter buf = null;
|
||||
try {
|
||||
writer = new FileWriter(file);
|
||||
BufferedWriter buf = new BufferedWriter(writer);
|
||||
buf = new BufferedWriter(writer);
|
||||
|
||||
for (int i = 0; i < numMonths; i++) {
|
||||
int monthIdx = month + i;
|
||||
|
@ -688,11 +690,15 @@ public class WindRoseDataMgr implements PyProcessListener {
|
|||
buf.write("\n");
|
||||
}
|
||||
}
|
||||
buf.close();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
buf.close();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ import com.raytheon.viz.aviation.observer.TafMonitorDlg;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 3, 2009 njensen Initial creation
|
||||
* Sep 3, 2009 njensen Initial creation
|
||||
* 19Mar2014 #2925 lvenable Added dispose checks for runAsync.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -56,7 +57,9 @@ public abstract class MonitorObserver implements IAlertObserver {
|
|||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dialog.getMessageBar().setMessageText(msg, GREEN);
|
||||
if (dialog.isDisposed() == false) {
|
||||
dialog.getMessageBar().setMessageText(msg, GREEN);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ import com.raytheon.viz.avnconfig.IStatusSettable;
|
|||
* 20JUL2012 14570 gzhang/zhao Add data structure for highlighting correct time groups in TAF viewer
|
||||
* 01/02/2013 15606 gzhang Remove GridData widthHint so button/label size change with GUI
|
||||
* 03/07/2013 1735 rferrel Flag to indicate grid data is needed.
|
||||
* 19Mar2014 #2925 lvenable Added dispose checks for runAsync.
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -554,8 +555,11 @@ public class TafSiteComp {
|
|||
if (taf == null) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
public void run() {
|
||||
siteIdBtn.setBackground(getErrorColor());
|
||||
tafTimeLbl.setText("HH:MM");
|
||||
if (siteIdBtn.isDisposed() == false
|
||||
&& tafTimeLbl.isDisposed() == false) {
|
||||
siteIdBtn.setBackground(getErrorColor());
|
||||
tafTimeLbl.setText("HH:MM");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -824,6 +828,8 @@ public class TafSiteComp {
|
|||
// Update viewer with new TAF.
|
||||
VizApp.runAsync(new Runnable() {
|
||||
public void run() {
|
||||
// Not checking for a dispose since this is an interface.
|
||||
// The method should be responsible for handling this.
|
||||
tveDlg.updateSettings(TafSettings.UPDATE_VIEW, stationName);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue