Issue #2349 - Fixed font memory leaks

Former-commit-id: 0816c3e7c7 [formerly 02651018f2 [formerly e81149f65d944f9898509a6ff03b063662a88882]]
Former-commit-id: 02651018f2
Former-commit-id: 6b171d20db
This commit is contained in:
Lee Venable 2013-09-09 16:54:49 -05:00
parent f494403505
commit 09d6775293
4 changed files with 541 additions and 486 deletions

View file

@ -46,6 +46,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 26, 2011 mpduff Initial creation * Jan 26, 2011 mpduff Initial creation
* Dec 07, 2012 1353 rferrel Make dialog non-blocking. * Dec 07, 2012 1353 rferrel Make dialog non-blocking.
* 09 Sep 2013 #2349 lvenable Fixed Font memory leak.
* *
* </pre> * </pre>
* *
@ -168,6 +169,14 @@ public class GetAppsDefaults extends CaveSWTDialog {
}); });
} }
@Override
protected void disposed() {
if (font != null) {
font.dispose();
font = null;
}
}
private void gad() { private void gad() {
String token = searchField.getText(); String token = searchField.getText();
if ((token != null) && (token.length() > 0)) { if ((token != null) && (token.length() > 0)) {

View file

@ -69,6 +69,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 21 Feb 2010 2915 mpduff Fixed Time Zone problem. * 21 Feb 2010 2915 mpduff Fixed Time Zone problem.
* 23 Feb 2010 4303 mpduff Changed the &quot;missing&quot; date display to be N/A. * 23 Feb 2010 4303 mpduff Changed the &quot;missing&quot; date display to be N/A.
* 16 Apr 2013 1790 rferrel Make dialog non-blocking. * 16 Apr 2013 1790 rferrel Make dialog non-blocking.
* 09 Sep 2013 #2349 lvenable Fixed Font memory leak.
* *
* </pre> * </pre>
* *
@ -195,7 +196,13 @@ public class StationReportingStatusDlg extends CaveSWTDialog {
*/ */
@Override @Override
protected void disposed() { protected void disposed() {
font.dispose(); if (font != null) {
font.dispose();
}
if (controlFont != null) {
controlFont.dispose();
}
} }
/* /*
@ -632,7 +639,7 @@ public class StationReportingStatusDlg extends CaveSWTDialog {
for (StationReportingData currData : obsForLid) { for (StationReportingData currData : obsForLid) {
String entry = String String entry = String
.format("%-8s %-3s %-5d %-4s %-2s %-17s %-8.2f %-2s %-2s %-2s %-11s %-16s %-16s", // .format("%-8s %-3s %-5d %-4s %-2s %-17s %-8.2f %-2s %-2s %-2s %-11s %-16s %-16s", //
currData.getLid(), // currData.getLid(), //
currData.getPe(),// currData.getPe(),//
currData.getDur(), // currData.getDur(), //
currData.getTs(), // currData.getTs(), //

View file

@ -22,6 +22,8 @@ package com.raytheon.viz.hydrocommon.ratingcurve;
import java.util.List; import java.util.List;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseMoveListener; import org.eclipse.swt.events.MouseMoveListener;
@ -44,6 +46,7 @@ import org.eclipse.swt.widgets.Composite;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 8, 2008 lvenable Initial creation * Sep 8, 2008 lvenable Initial creation
* Jul 15, 2013 2088 rferrel Code clean part of non-blocking dialogs. * Jul 15, 2013 2088 rferrel Code clean part of non-blocking dialogs.
* 09 Sep 2013 #2349 lvenable Fixed Font memory leak.
* *
* </pre> * </pre>
* *
@ -279,6 +282,15 @@ public class RatingCurveCanvasComp extends Canvas {
calcMaxStageMaxFlow(); calcMaxStageMaxFlow();
calcPixelsPerIncrement(); calcPixelsPerIncrement();
setupCanvas(); setupCanvas();
parent.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
if (canvasFont != null) {
canvasFont.dispose();
}
}
});
} }
/** /**