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
*    (using <code>setSelectionToWidget</code></li>
 *  <li>rediscovers the resulting selection (via <code>getSelection</code>)</li>
 *  <li>calls <code>handleInvalidSelection</code> if the selection
 *    did not take</li>
 *  <li>calls <code>postUpdateHook</code></li>
 * </ul>
 * </p>
 *
 * @param updateCode the code to run
 */
protected void preservingSelection(Runnable updateCode) {
	
	ISelection oldSelection= null;
	try {
		
		oldSelection= getSelection();
		inChange= restoreSelection= true;
		
		
		updateCode.run();
				
	} finally {
		inChange= false;
		
		
		if (restoreSelection)
			setSelectionToWidget(oldSelection, false);
		
		
		ISelection newSelection= getSelection();