mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 14:15:23 +02:00
Bug 241789 - [view model] RejectedExecutionException during shutdown of Eclipse while a debug session is active
This commit is contained in:
parent
83c49e7875
commit
41c8b18397
4 changed files with 60 additions and 20 deletions
|
@ -165,9 +165,17 @@ public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2
|
|||
}
|
||||
}
|
||||
|
||||
private Map<PDALaunch, LaunchAdapterSet> fLaunchAdapterSets =
|
||||
private static Map<PDALaunch, LaunchAdapterSet> fgLaunchAdapterSets =
|
||||
Collections.synchronizedMap(new HashMap<PDALaunch, LaunchAdapterSet>());
|
||||
|
||||
|
||||
static void disposeAdapterSet(ILaunch launch) {
|
||||
synchronized(fgLaunchAdapterSets) {
|
||||
if ( fgLaunchAdapterSets.containsKey(launch) ) {
|
||||
fgLaunchAdapterSets.remove(launch).dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PDAAdapterFactory() {
|
||||
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
|
||||
}
|
||||
|
@ -183,11 +191,11 @@ public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2
|
|||
// it means that we have a new launch, and we have to create a
|
||||
// new set of adapters.
|
||||
LaunchAdapterSet adapterSet;
|
||||
synchronized(fLaunchAdapterSets) {
|
||||
adapterSet = fLaunchAdapterSets.get(launch);
|
||||
synchronized(fgLaunchAdapterSets) {
|
||||
adapterSet = fgLaunchAdapterSets.get(launch);
|
||||
if (adapterSet == null) {
|
||||
adapterSet = new LaunchAdapterSet(launch);
|
||||
fLaunchAdapterSets.put(launch, adapterSet);
|
||||
fgLaunchAdapterSets.put(launch, adapterSet);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,12 +216,7 @@ public class PDAAdapterFactory implements IAdapterFactory, ILaunchesListener2
|
|||
// are still needed to populate the contents of the view.
|
||||
for (ILaunch launch : launches) {
|
||||
if (launch instanceof PDALaunch) {
|
||||
PDALaunch pdaLaunch = (PDALaunch)launch;
|
||||
synchronized(fLaunchAdapterSets) {
|
||||
if ( fLaunchAdapterSets.containsKey(pdaLaunch) ) {
|
||||
fLaunchAdapterSets.remove(pdaLaunch).dispose();
|
||||
}
|
||||
}
|
||||
disposeAdapterSet(launch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@ import java.net.URL;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.dd.examples.pda.launch.PDALaunch;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
|
@ -67,6 +70,7 @@ public class PDAUIPlugin extends AbstractUIPlugin {
|
|||
/**
|
||||
* This method is called upon plug-in activation
|
||||
*/
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
fContext = context;
|
||||
super.start(context);
|
||||
|
@ -79,7 +83,9 @@ public class PDAUIPlugin extends AbstractUIPlugin {
|
|||
/**
|
||||
* This method is called when the plug-in is stopped
|
||||
*/
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
disposeAdapterSets();
|
||||
super.stop(context);
|
||||
plugin = null;
|
||||
fContext = null;
|
||||
|
@ -99,6 +105,7 @@ public class PDAUIPlugin extends AbstractUIPlugin {
|
|||
return fContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeImageRegistry(ImageRegistry reg) {
|
||||
declareImage(IMG_OBJ_PDA, PATH_OBJECT + "pda.gif");
|
||||
}
|
||||
|
@ -134,4 +141,15 @@ public class PDAUIPlugin extends AbstractUIPlugin {
|
|||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose adapter sets for all launches.
|
||||
*/
|
||||
private void disposeAdapterSets() {
|
||||
for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
|
||||
if (launch instanceof PDALaunch) {
|
||||
PDAAdapterFactory.disposeAdapterSet(launch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -184,9 +184,17 @@ public class GdbAdapterFactory
|
|||
|
||||
}
|
||||
|
||||
private Map<GdbLaunch, SessionAdapterSet> fLaunchAdapterSets =
|
||||
private static Map<GdbLaunch, SessionAdapterSet> fgLaunchAdapterSets =
|
||||
Collections.synchronizedMap(new HashMap<GdbLaunch, SessionAdapterSet>());
|
||||
|
||||
static void disposeAdapterSet(ILaunch launch) {
|
||||
synchronized(fgLaunchAdapterSets) {
|
||||
if ( fgLaunchAdapterSets.containsKey(launch) ) {
|
||||
fgLaunchAdapterSets.remove(launch).dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GdbAdapterFactory() {
|
||||
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
|
||||
}
|
||||
|
@ -207,11 +215,11 @@ public class GdbAdapterFactory
|
|||
if (session == null) return null;
|
||||
|
||||
SessionAdapterSet adapterSet;
|
||||
synchronized(fLaunchAdapterSets) {
|
||||
adapterSet = fLaunchAdapterSets.get(launch);
|
||||
synchronized(fgLaunchAdapterSets) {
|
||||
adapterSet = fgLaunchAdapterSets.get(launch);
|
||||
if (adapterSet == null) {
|
||||
adapterSet = new SessionAdapterSet(launch);
|
||||
fLaunchAdapterSets.put(launch, adapterSet);
|
||||
fgLaunchAdapterSets.put(launch, adapterSet);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,11 +244,7 @@ public class GdbAdapterFactory
|
|||
// removed.
|
||||
for (ILaunch launch : launches) {
|
||||
if (launch instanceof GdbLaunch) {
|
||||
synchronized(fLaunchAdapterSets) {
|
||||
if ( fLaunchAdapterSets.containsKey(launch) ) {
|
||||
fLaunchAdapterSets.remove(launch).dispose();
|
||||
}
|
||||
}
|
||||
disposeAdapterSet(launch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,10 @@ package org.eclipse.dd.gdb.internal.ui;
|
|||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.dd.gdb.internal.provisional.launching.GdbLaunch;
|
||||
import org.eclipse.dd.gdb.internal.provisional.launching.LaunchMessages;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
|
@ -57,11 +60,23 @@ public class GdbUIPlugin extends AbstractUIPlugin {
|
|||
*/
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
disposeAdapterSets();
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
fgBundleContext = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose adapter sets for all launches.
|
||||
*/
|
||||
private void disposeAdapterSets() {
|
||||
for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
|
||||
if (launch instanceof GdbLaunch) {
|
||||
GdbAdapterFactory.disposeAdapterSet(launch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue