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
public void refresh(boolean updateLabels) {
	refresh(getRoot(), updateLabels);
}
/**
 * Refreshes this viewer starting with the given element.
 * <p>
 * Unlike the <code>update</code> methods, this handles structural changes
 * to the given element (e.g. addition or removal of children).
 * If only the given element needs updating, it is more efficient to use
 * the <code>update</code> methods.
 * </p>
 *
 * @param element the element
 */
public void refresh(final Object element) {
	preservingSelection(new Runnable() {
		public void run() {
			internalRefresh(element);
		}
	});
}
/**
 * Refreshes this viewer starting with the given element.
 * Labels are updated as described in <code>refresh(boolean updateLabels)</code>.
 * <p>
 * Unlike the <code>update</code> methods, this handles structural changes
 * to the given element (e.g. addition or removal of children).
 * If only the given element needs updating, it is more efficient to use
 * the <code>update</code> methods.
 * </p>