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
* This method is internal to the framework; subclassers should not call
 * this method.
 * </p>
 *
 * @param element the element
 * @param property the property
 * @return <code>true</code> if refiltering is required, and <code>false</code>
 *   otherwise
 */
protected boolean needsRefilter(Object element, String property) {
	if (sorter != null && sorter.isSorterProperty(element, property))
		return true;
	if (filters != null) {
		for (int i = 0, n = filters.size(); i < n; ++i) {
			ViewerFilter filter = (ViewerFilter) filters.get(i);
			if (filter.isFilterProperty(element, property))
				return true;
		}
	}
	return false;
}
/**
 * Attempts to preserves the current selection across a run of
 * the given code.
 * <p>
 * The default implementation of this method:
 * <ul>
 *  <li>discovers the old selection (via <code>getSelection</code>)</li>
 *  <li>runs the given runnable</li>
 *  <li>attempts to restore the old selection