Issue #2401 - fixed font memory leak.

Former-commit-id: db40b2f58d [formerly f88e789cac] [formerly 65f09e7836] [formerly 0c8b1d9e81 [formerly 65f09e7836 [formerly b0348adde41de3880662683d0f5d133a6a9f4140]]]
Former-commit-id: 0c8b1d9e81
Former-commit-id: bb2a733b09cadf9b730dc57a9f0c1cac11fafcd0 [formerly 976486a1d5]
Former-commit-id: 6b98958716
This commit is contained in:
Lee Venable 2013-09-24 09:01:29 -05:00
parent 5783856d0c
commit b5c047cc80

View file

@ -148,6 +148,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Jul 29, 2013 DR 16352 D. Friedman Move 'result' to okPressed().
* Aug 6, 2013 2243 jsanchez Refreshed the follow up list every minute.
* Aug 15, 2013 DR 16418 D. Friedman Make dialog visibility match editable state.
* Sep 24, 2013 #2401 lvenable Fixed font memory leak.
* </pre>
*
* @author chammack
@ -284,6 +285,9 @@ public class WarngenDialog extends CaveSWTDialog implements
private final IWarngenObserver wed = new WarningSender();
/** Bullet list font. */
private Font bulletListFont = null;
public WarngenDialog(Shell parentShell, WarngenLayer layer) {
super(parentShell, SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE,
CAVE.DO_NOT_BLOCK | CAVE.INDEPENDENT_SHELL);
@ -295,6 +299,10 @@ public class WarngenDialog extends CaveSWTDialog implements
@Override
protected void disposed() {
if (bulletListFont != null) {
bulletListFont.dispose();
}
timer.cancel();
updateTimeTask.cancel();
CurrentWarnings.removeListener(this);
@ -347,9 +355,10 @@ public class WarngenDialog extends CaveSWTDialog implements
private void createBulletListAndLabel(Composite mainComposite) {
bulletList = new List(mainComposite, SWT.MULTI | SWT.V_SCROLL
| SWT.H_SCROLL | SWT.BORDER);
bulletList.setFont(new Font(getDisplay(), bulletList.getFont()
bulletListFont = new Font(getDisplay(), bulletList.getFont()
.getFontData()[0].getName(), FONT_HEIGHT, bulletList.getFont()
.getFontData()[0].getStyle()));
.getFontData()[0].getStyle());
bulletList.setFont(bulletListFont);
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
gd.widthHint = BULLET_WIDTH;