Bug 184980 [WorkbenchLauncher] Three colors and a font leaked on switch workspace dialog
Build: I20070501-0010 1) File > Switch workspace > Other... 2) Click Cancel -> Each time these steps are repeated, three Color objects and one Font object are leaked. The three Color allocations look like this (from Sleak): java.lang.Error at java.lang.Throwable.<init>(Throwable.java:56) at org.eclipse.swt.graphics.Device.new_Object(Device.java:787) at org.eclipse.swt.graphics.Color.<init>(Color.java:80) at org.eclipse.ui.forms.FormColors.createColor(FormColors.java:256) at org.eclipse.ui.forms.FormColors.createColor(FormColors.java:212) at org.eclipse.ui.forms.FormColors.initializeColorTable(FormColors.java:151) at org.eclipse.ui.forms.FormColors.initialize(FormColors.java:138) at org.eclipse.ui.forms.FormColors.<init>(FormColors.java:116) at org.eclipse.ui.forms.widgets.FormToolkit.<init>(FormToolkit.java:220) at org.eclipse.ui.internal.ide.ChooseWorkspaceWithSettingsDialog.createSettingsControls(ChooseWorkspaceWithSettingsDialog.java:113) at org.eclipse.ui.internal.ide.ChooseWorkspaceWithSettingsDialog.createDialogArea(ChooseWorkspaceWithSettingsDialog.java:101) at org.eclipse.jface.dialogs.TitleAreaDialog.createContents(TitleAreaDialog.java:147) And the single Font leak looks like this: java.lang.Error at java.lang.Throwable.<init>(Throwable.java:56) at org.eclipse.swt.graphics.Device.new_Object(Device.java:787) at org.eclipse.swt.graphics.Font.<init>(Font.java:108) at org.eclipse.ui.internal.forms.widgets.FormUtil.createBoldFont(FormUtil.java:471) at org.eclipse.ui.forms.widgets.FormToolkit$BoldFontHolder.createBoldFont(FormToolkit.java:203) at org.eclipse.ui.forms.widgets.FormToolkit$BoldFontHolder.getBoldFont(FormToolkit.java:192) at org.eclipse.ui.forms.widgets.FormToolkit.createExpandableComposite(FormToolkit.java:526) at org.eclipse.ui.internal.ide.ChooseWorkspaceWithSettingsDialog.createSettingsControls(ChooseWorkspaceWithSettingsDialog.java:121) at org.eclipse.ui.internal.ide.ChooseWorkspaceWithSettingsDialog.createDialogArea(ChooseWorkspaceWithSettingsDialog.java:101)
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/ChooseWorkspaceWithSettingsDialog.java
final ScrolledForm form = toolkit.createScrolledForm(workArea);
		form.setBackground(workArea.getBackground());
		form.getBody().setLayout(new GridLayout());
		GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
		form.setLayoutData(layoutData);
		final ExpandableComposite expandable = toolkit
				.createExpandableComposite(form.getBody(),
						ExpandableComposite.TWISTIE);
		expandable
				.setText(IDEWorkbenchMessages.ChooseWorkspaceWithSettingsDialog_SettingsGroupName);
		expandable.setBackground(workArea.getBackground());
		expandable.setLayout(new GridLayout());
		expandable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		expandable.addExpansionListener(new IExpansionListener() {
			boolean notExpanded = true;
			/*
			 * (non-Javadoc)
			 * 
			 * @see org.eclipse.ui.forms.events.IExpansionListener#expansionStateChanged(org.eclipse.ui.forms.events.ExpansionEvent)
			 */
			public void expansionStateChanged(ExpansionEvent e) {
				form.reflow(true);
				if (e.getState() && notExpanded) {
					getShell().setRedraw(false);
					Rectangle shellBounds = getShell().getBounds();
					int entriesToShow = Math.min(4, SettingsTransfer
							.getSettingsTransfers().length);
					shellBounds.height += convertHeightInCharsToPixels(entriesToShow)
							+ IDialogConstants.VERTICAL_SPACING;
					getShell().setBounds(shellBounds);