Project: Eclipse_Platform_UI
Bug 241277 [ErrorHandling] DefaultDetailsArea and StackTraceSupportArea leak Clipboards
Reported: 2008-07-17 11:56:37 | Status: verified fixed

3.4 DefaultDetailsArea and StackTraceSupportArea leak Clipboards. Their #createCopyAction(Composite) create selection listeners which overwrite the field 'clipboard' every time they are invoked, without disposing the previous instance first. The best fix would be to remove the field 'clipboard' and the dispose listener, and to change the widgetSelected(..) method to: public void widgetSelected(SelectionEvent e) { Clipboard clipboard = new Clipboard(parent.getDisplay()); try { clipboard.setContents(new Object[] { prepareCopyString() }, new Transfer[] { TextTransfer.getInstance() }); } finally { clipboard.dispose(); } } There's no need to retain the clipboard after the copy operation has been executed

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/DefaultDetailsArea.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/StackTraceSupportArea.java