1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 235300 [disassembly] AssertionError when switching between multiple debug sessions with active disassembly view

This commit is contained in:
Anton Leherbauer 2008-07-09 12:54:48 +00:00
parent 322474d43b
commit 1058d3caf2

View file

@ -191,7 +191,7 @@ import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
* DisassemblyPart * DisassemblyPart
*/ */
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
public abstract class DisassemblyPart extends WorkbenchPart implements IDisassemblyPart, IViewportListener, ITextPresentationListener { public abstract class DisassemblyPart extends WorkbenchPart implements IDisassemblyPart, IViewportListener, ITextPresentationListener, SessionEndedListener {
private final static boolean DEBUG = DsfDebugUIPlugin.getDefault().isDebugging(); private final static boolean DEBUG = DsfDebugUIPlugin.getDefault().isDebugging();
@ -794,6 +794,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
} else { } else {
updateDebugContext(); updateDebugContext();
} }
DsfSession.addSessionEndedListener(this);
} }
/* /*
@ -828,12 +829,9 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
ctxService.deactivateContext(fContextActivation); ctxService.deactivateContext(fContextActivation);
} }
fViewer = null; fViewer = null;
fDebugSessionId = null; setDebugContext(null);
fTargetContext= null; DsfSession.removeSessionEndedListener(this);
if (fServicesTracker != null) {
fServicesTracker.dispose();
fServicesTracker= null;
}
fAnnotationAccess = null; fAnnotationAccess = null;
fAnnotationPreferences = null; fAnnotationPreferences = null;
fAnnotationRulerColumn = null; fAnnotationRulerColumn = null;
@ -2323,6 +2321,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
} }
} }
if (fTargetContext != null) { if (fTargetContext != null) {
if (fDebugSessionId != null) {
if (getSession() != null) {
getSession().removeServiceEventListener(this);
}
}
fDebugSessionId= sessionId; fDebugSessionId= sessionId;
if (fServicesTracker != null) { if (fServicesTracker != null) {
fServicesTracker.dispose(); fServicesTracker.dispose();
@ -2351,6 +2354,10 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
} }
fDebugSessionId= null; fDebugSessionId= null;
fTargetContext= null; fTargetContext= null;
if (fServicesTracker != null) {
fServicesTracker.dispose();
fServicesTracker= null;
}
if (fViewer != null) { if (fViewer != null) {
debugContextChanged(); debugContextChanged();
} }
@ -2365,17 +2372,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
if (fDebugSessionId != null) { if (fDebugSessionId != null) {
final DsfSession session= getSession(); final DsfSession session= getSession();
session.addServiceEventListener(this, null); session.addServiceEventListener(this, null);
DsfSession.addSessionEndedListener(new SessionEndedListener() {
public void sessionEnded(DsfSession endedSsession) {
if (session == endedSsession) {
DsfSession.removeSessionEndedListener(this);
asyncExec(new Runnable() {
public void run() {
setDebugContext(null);
}});
}
}});
updatePC(PC_UNKNOWN); updatePC(PC_UNKNOWN);
if (fGotoAddressPending != PC_UNKNOWN) { if (fGotoAddressPending != PC_UNKNOWN) {
@ -2399,6 +2395,18 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
firePropertyChange(PROP_SUSPENDED); firePropertyChange(PROP_SUSPENDED);
} }
/*
* @see org.eclipse.dd.dsf.service.DsfSession.SessionEndedListener#sessionEnded(org.eclipse.dd.dsf.service.DsfSession)
*/
public void sessionEnded(DsfSession endedSsession) {
if (endedSsession.getId().equals(fDebugSessionId)) {
asyncExec(new Runnable() {
public void run() {
setDebugContext(null);
}});
}
}
@DsfServiceEventHandler @DsfServiceEventHandler
public void handleEvent(IExitedDMEvent event) { public void handleEvent(IExitedDMEvent event) {
if (event.getDMContext().equals(fTargetContext) if (event.getDMContext().equals(fTargetContext)