1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-13 11:15:38 +02:00

Bug 518627: Squelch Device Disposed exception at shutdown

Note, can't simply check isDisposed as that still leaves a race
condition between isDisposed call and asyncExec call

Change-Id: I3e0e196d9d1dd9b9c8d4048a1aec55405d6dd6e0
This commit is contained in:
Jonah Graham 2017-06-22 11:29:57 +01:00
parent bd4656755c
commit d8c3c0967d
2 changed files with 19 additions and 2 deletions

View file

@ -23,6 +23,7 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IConsoleView;
@ -145,7 +146,14 @@ public class GdbBasicCliConsole extends IOConsole implements IGDBDebuggerConsole
String newName = computeName();
String name = getName();
if (!name.equals(newName)) {
try {
PlatformUI.getWorkbench().getDisplay().asyncExec(() -> setName(newName));
} catch (SWTException e) {
// display may be disposed, so ignore the exception
if (e.code != SWT.ERROR_WIDGET_DISPOSED) {
throw e;
}
}
}
}

View file

@ -13,6 +13,8 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.AbstractConsole;
import org.eclipse.ui.console.IConsoleView;
@ -59,7 +61,14 @@ public class GdbFullCliConsole extends AbstractConsole implements IGDBDebuggerCo
String newName = computeName();
String name = getName();
if (!name.equals(newName)) {
try {
PlatformUI.getWorkbench().getDisplay().asyncExec(() -> setName(newName));
} catch (SWTException e) {
// display may be disposed, so ignore the exception
if (e.code != SWT.ERROR_WIDGET_DISPOSED) {
throw e;
}
}
}
}