1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

[292271] DsfSession.addServiceEventListener must be used on the Executor thread.

This commit is contained in:
Marc Khouzam 2009-10-15 12:32:03 +00:00
parent 4752115f03
commit e436aadfcd
2 changed files with 41 additions and 15 deletions

View file

@ -1765,7 +1765,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
String debuggerPath= file;
// try reverse lookup
final ISourceLookup lookup= getService(ISourceLookup.class);
final ISourceLookupDMContext ctx= DMContexts.getAncestorOfType(fTargetContext, ISourceLookupDMContext.class);
final DsfExecutor executor= getSession().getExecutor();
Query<String> query= new Query<String>() {
@ -1778,6 +1777,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
rm.done();
}
};
final ISourceLookup lookup= getService(ISourceLookup.class);
lookup.getDebuggerPath(ctx, file, request);
}
};
@ -2361,14 +2361,22 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
if (fTargetContext != null) {
if (fDebugSessionId != null) {
if (getSession() != null) {
getSession().removeServiceEventListener(this);
if (getSession() != null) {
// Store the values that we are going to change
final DsfSession session = getSession();
final DsfServicesTracker trackerToDispose= fServicesTracker;
session.getExecutor().execute(new DsfRunnable() {
public void run() {
session.removeServiceEventListener(DisassemblyPart.this);
if (trackerToDispose != null) {
trackerToDispose.dispose();
}
}
});
}
}
fDebugSessionId= sessionId;
if (fServicesTracker != null) {
fServicesTracker.dispose();
}
fServicesTracker = new DsfServicesTracker(DsfUIPlugin.getBundleContext(), sessionId);
if (fViewer != null) {
debugContextChanged();
@ -2389,14 +2397,22 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
}
} else if (fDebugSessionId != null) {
if (getSession() != null) {
getSession().removeServiceEventListener(this);
// Store the values that we are going to change
final DsfSession session = getSession();
final DsfServicesTracker trackerToDispose= fServicesTracker;
session.getExecutor().execute(new DsfRunnable() {
public void run() {
session.removeServiceEventListener(DisassemblyPart.this);
if (trackerToDispose != null) {
trackerToDispose.dispose();
}
}
});
}
fDebugSessionId= null;
fTargetContext= null;
if (fServicesTracker != null) {
fServicesTracker.dispose();
fServicesTracker= null;
}
fServicesTracker= null;
if (fViewer != null) {
debugContextChanged();
}
@ -2410,7 +2426,12 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
resetViewer();
if (fDebugSessionId != null) {
final DsfSession session= getSession();
session.addServiceEventListener(this, null);
session.getExecutor().execute(new DsfRunnable() {
public void run() {
session.addServiceEventListener(DisassemblyPart.this, null);
}
});
updatePC(PC_UNKNOWN);
if (fGotoAddressPending != PC_UNKNOWN) {

View file

@ -591,7 +591,9 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
final IInstructionPointerPresentation ipPresentation = (IInstructionPointerPresentation) session.getModelAdapter(IInstructionPointerPresentation.class);
fIPManager = new InstructionPointerManager(ipPresentation);
fSession.addServiceEventListener(this, null);
fExecutor.execute(new DsfRunnable() { public void run() {
fSession.addServiceEventListener(DsfSourceDisplayAdapter.this, null);
}});
fController = controller;
if (fController != null) {
@ -616,8 +618,11 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
fController.removeSteppingControlParticipant(this);
fController = null;
}
fSession.removeServiceEventListener(this);
fServicesTracker.dispose();
fExecutor.execute(new DsfRunnable() { public void run() {
fSession.removeServiceEventListener(DsfSourceDisplayAdapter.this);
fServicesTracker.dispose();
}});
fSourceLookup.removeParticipants(new ISourceLookupParticipant[] {fSourceLookupParticipant});
// fSourceLookupParticipant is disposed by the source lookup director