1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22:11 +02:00

Bug 434645 - Deadlock in DsfExecutor on project close while in debug

session leading to UI freeze

Execute ITerminate@terminate() asynchronously

Change-Id: Ieba37912b7760f8db38b0f14e9562f07d7064af6
Reviewed-on: https://git.eclipse.org/r/26365
Tested-by: Hudson CI
Reviewed-by: Alvaro Sanchez-Leon <alvsan09@gmail.com>
Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com>
Reviewed-by: Teodor Madan <teodor.madan@freescale.com>
Tested-by: Teodor Madan <teodor.madan@freescale.com>
This commit is contained in:
Teodor Madan 2014-05-12 16:19:36 +03:00
parent fb6c8ae2ab
commit ab5c43e46a

View file

@ -46,10 +46,12 @@ import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
@ -195,6 +197,33 @@ public class GdbLaunch extends DsfLaunch
public boolean canTerminate() {
return fInitialized && super.canTerminate();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.Launch#terminate()
*/
@Override
public void terminate() throws DebugException {
// Execute asynchronously to avoid potential deadlocks
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=434645
//
Job job = new Job("Terminate session") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
GdbLaunch.super.terminate();
} catch (DebugException e) {
return new MultiStatus(
GdbPlugin.PLUGIN_ID, IStatus.ERROR, new IStatus[]{e.getStatus()}, "Terminate session failed", e); //$NON-NLS-1$
}
return Status.OK_STATUS;
}
};
job.setSystem(true);
job.schedule();
}
// ITerminate
///////////////////////////////////////////////////////////////////////////
@ -214,6 +243,7 @@ public class GdbLaunch extends DsfLaunch
public void disconnect() throws DebugException {
terminate();
}
// IDisconnect
///////////////////////////////////////////////////////////////////////////