Bug 307858 [Markers] UIUpdateJob may throw SWTException if control has been disposed
The runInUIThread(IProgressMonitor) method looks something like this... try { /* ... */ if (viewer.getControl().isDisposed()) { return Status.CANCEL_STATUS; } /* ... */ } finally { viewer.getTree().setRedraw(true); /* ... */ } The problem here is that the 'finally' block gets executed if the control is disposed. Since the control has been disposed, the setRedraw(boolean) invocation throws an SWTException. org.eclipse.swt.SWTException: Widget is disposed at org.eclipse.swt.SWT.error(SWT.java:4083) at org.eclipse.swt.SWT.error(SWT.java:3998) at org.eclipse.swt.SWT.error(SWT.java:3969) at org.eclipse.swt.widgets.Widget.error(Widget.java:467) at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:340) at org.eclipse.swt.widgets.Tree.setRedraw(Tree.java:4734) at org.eclipse.ui.internal.views.markers.UIUpdateJob.runInUIThread(UIUpdateJob.java:120) at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/UIUpdateJob.java
/*******************************************************************************
 * Copyright (c) 2009 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 ******************************************************************************/
package org.eclipse.ui.internal.views.markers;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.WorkbenchJob;
import org.eclipse.ui.views.markers.internal.MarkerMessages;
/**
 * The UIUpdateJob runs in the UI thread and is responsible updating the Markers
 * view UI with newly updated markers.
 * 
 * @since 3.6
 * 
 */
class UIUpdateJob extends WorkbenchJob {