mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
[183176] Fix "widget is disposed" during Platform shutdown
This commit is contained in:
parent
2b22909214
commit
d29d26279d
2 changed files with 41 additions and 19 deletions
1
rse/plugins/org.eclipse.rse.ui/.options
Normal file
1
rse/plugins/org.eclipse.rse.ui/.options
Normal file
|
@ -0,0 +1 @@
|
||||||
|
org.eclipse.rse.ui/debug = true
|
|
@ -40,6 +40,7 @@
|
||||||
* Kevin Doyle (IBM) - [198576] Renaming a folder directly under a Filter doesn't update children
|
* Kevin Doyle (IBM) - [198576] Renaming a folder directly under a Filter doesn't update children
|
||||||
* Kevin Doyle (IBM) - [196582] Deprecated getRemoteObjectIdentifier
|
* Kevin Doyle (IBM) - [196582] Deprecated getRemoteObjectIdentifier
|
||||||
* Martin Oberhuber (Wind River) - [198650] Fix assertion when restoring workbench state
|
* Martin Oberhuber (Wind River) - [198650] Fix assertion when restoring workbench state
|
||||||
|
* Martin Oberhuber (Wind River) - [183176] Fix "widget is disposed" during Platform shutdown
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.ui.view;
|
package org.eclipse.rse.internal.ui.view;
|
||||||
|
@ -55,6 +56,7 @@ import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.jface.action.ActionContributionItem;
|
import org.eclipse.jface.action.ActionContributionItem;
|
||||||
|
@ -1153,12 +1155,11 @@ public class SystemView extends SafeTreeViewer
|
||||||
* Convenience method for returning the shell of this viewer.
|
* Convenience method for returning the shell of this viewer.
|
||||||
*/
|
*/
|
||||||
public Shell getShell() {
|
public Shell getShell() {
|
||||||
////getShell() can lead to "widget is disposed" errors, but avoiding them here does not really help
|
//getShell() can lead to "widget is disposed" errors, but avoiding them here does not really help
|
||||||
//if (!getTree().isDisposed()) {
|
if (!getTree().isDisposed()) {
|
||||||
// return getTree().getShell();
|
return getTree().getShell();
|
||||||
//}
|
}
|
||||||
//return shell;
|
return shell;
|
||||||
return getTree().getShell();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1620,22 +1621,38 @@ public class SystemView extends SafeTreeViewer
|
||||||
* Called when something changes in the model
|
* Called when something changes in the model
|
||||||
*/
|
*/
|
||||||
public void systemResourceChanged(ISystemResourceChangeEvent event) {
|
public void systemResourceChanged(ISystemResourceChangeEvent event) {
|
||||||
ResourceChangedJob job = new ResourceChangedJob(event, this);
|
if (!getControl().isDisposed()) {
|
||||||
job.setPriority(Job.INTERACTIVE);
|
ResourceChangedJob job = new ResourceChangedJob(event, this);
|
||||||
//job.setUser(true);
|
job.setPriority(Job.INTERACTIVE);
|
||||||
job.schedule();
|
//job.setUser(true);
|
||||||
/*
|
job.schedule();
|
||||||
Display display = Display.getCurrent();
|
/*
|
||||||
try {
|
Display display = Display.getCurrent();
|
||||||
while (job.getResult() == null) {
|
try {
|
||||||
while (display != null && display.readAndDispatch()) {
|
while (job.getResult() == null) {
|
||||||
//Process everything on event queue
|
while (display != null && display.readAndDispatch()) {
|
||||||
|
//Process everything on event queue
|
||||||
|
}
|
||||||
|
if (job.getResult() == null) Thread.sleep(200);
|
||||||
}
|
}
|
||||||
if (job.getResult() == null) Thread.sleep(200);
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
} else {
|
||||||
|
trace("resource changed while shutting down"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void trace(String str) {
|
||||||
|
String id = RSEUIPlugin.getDefault().getBundle().getSymbolicName();
|
||||||
|
String val = Platform.getDebugOption(id + "/debug"); //$NON-NLS-1$
|
||||||
|
if ("true".equals(val)) { //$NON-NLS-1$
|
||||||
|
try {
|
||||||
|
throw new IllegalStateException(str);
|
||||||
|
} catch(IllegalStateException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1657,6 +1674,10 @@ public class SystemView extends SafeTreeViewer
|
||||||
}
|
}
|
||||||
|
|
||||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||||
|
if (getControl().isDisposed()) {
|
||||||
|
trace("SystemView: refresh after disposed"); //$NON-NLS-1$
|
||||||
|
return Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
int type = _event.getType();
|
int type = _event.getType();
|
||||||
Object src = _event.getSource();
|
Object src = _event.getSource();
|
||||||
Object parent = _event.getParent();
|
Object parent = _event.getParent();
|
||||||
|
|
Loading…
Add table
Reference in a new issue