Bug 44827 [Viewers] StructuredViewer's UpdateItemSafeRunnable holds onto last selected element-memory leak
I have a TableViewer that normally displays a list of objects. I clear the list by calling TableViewer.setInput(null). I found that if I initially have a list of objects, select an object, then setInput(null) the TableViewer is still holding onto an instance of the object I last selected. More specifically, it looks like StructuredViewer's UpdateItemSafeRunnable is holding onto the object. The UpdateItemSafeRunnable object should be cleared out after its use.
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java
/**
 * The <code>StructuredViewer</code> implementation of this <code>ContentViewer</code> method calls <code>update</code>
 * if the event specifies that the label of a given element has changed, otherwise it calls super.
 * Subclasses may reimplement or extend.
 * </p>
 */
protected void handleLabelProviderChanged(LabelProviderChangedEvent event) {
	Object[] elements = event.getElements();
	if (elements != null) {
		update(elements, null);
	}
	else {
		super.handleLabelProviderChanged(event);
	}
}
/**
 * Handles a select event from the widget.
 * <p>
 * This method is internal to the framework; subclassers should not call
 * this method.
 * </p>
 *
 * @param event the SWT selection event
 */
protected void handleSelect(SelectionEvent event) {
	
	Control control = getControl();
	if (control != null && !control.isDisposed()) {
		updateSelection(getSelection());
	}