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
Object[] listeners = postSelectionChangedListeners.getListeners();
	for (int i = 0; i < listeners.length; ++i) {
		final ISelectionChangedListener l = (ISelectionChangedListener)listeners[i];
		Platform.run(new SafeRunnable() {
			public void run() {
				l.selectionChanged(event);
			}
			public void handleException(Throwable e) {
				super.handleException(e);
				
				
				removeSelectionChangedListener(l);
			}
		});		
	}
}
/**
 * Returns the comparator to use for comparing elements,
 * or <code>null</code> if none has been set.
 * 
 * @param comparator the comparator to use for comparing elements
 *   or <code>null</code> 
 */
public IElementComparer getComparer() {
	return comparer;
}
/**
 * Returns the filtered array of children of the given element.
 * The resulting array must not be modified,
 * as it may come directly from the model's internal state.