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
* </p>
 * 
 * @param l list of selected elements (element type: <code>Object</code>)
 *   or <code>null</code> if the selection is to be cleared
 * @param reveal <code>true</code> if the selection is to be made
 *   visible, and <code>false</code> otherwise
 */
protected abstract void setSelectionToWidget(List l, boolean reveal);
/**
 * Converts the selection to a <code>List</code> and calls <code>setSelectionToWidget(List, boolean)</code>.
 * The selection is expected to be an <code>IStructuredSelection</code> of elements.
 * If not, the selection is cleared.
 * <p>
 * Subclasses do not typically override this method, but implement <code>setSelectionToWidget(List, boolean)</code> instead.
 *
 * @param selection an IStructuredSelection of elements
 * @param reveal <code>true</code> to reveal the first element in the selection, or <code>false</code> otherwise
 */
protected void setSelectionToWidget(ISelection selection, boolean reveal) {
	if (selection instanceof IStructuredSelection)
		setSelectionToWidget(((IStructuredSelection) selection).toList(), reveal);
	else
		setSelectionToWidget((List) null, reveal);
}
/**
 * Sets this viewer's sorter and triggers refiltering and resorting
 * of this viewer's element. Passing <code>null</code> turns sorting off.
 *
 * @param sorter a viewer sorter, or <code>null</code> if none
 */