Merge pull request #7367 from edumunoz/edumunoz/fix-leaking-bp-runcursor

Fixes #7366 Remove leaked breakpoint after stopping with run-to-cursor
This commit is contained in:
Isidor Nikolic 2016-06-15 09:56:52 +02:00 committed by GitHub
commit 7b336621fd
3 changed files with 7 additions and 14 deletions

View file

@ -257,11 +257,6 @@ export interface IRawDebugSession {
custom(request: string, args: any): TPromise<DebugProtocol.Response>;
/**
* Allows to register on each debug session stop event.
*/
onDidStop: Event<DebugProtocol.StoppedEvent>;
onDidEvent: Event<DebugProtocol.Event>;
}

View file

@ -557,11 +557,13 @@ export class RunToCursorAction extends EditorAction {
const lineNumber = this.editor.getPosition().lineNumber;
const uri = this.editor.getModel().uri;
const oneTimeListener = this.debugService.getActiveSession().onDidStop(() => {
const toRemove = this.debugService.getModel().getBreakpoints()
.filter(bp => bp.lineNumber === lineNumber && bp.source.uri.toString() === uri.toString()).pop();
this.debugService.removeBreakpoints(toRemove.getId());
oneTimeListener.dispose();
const oneTimeListener = this.debugService.getActiveSession().onDidEvent(event => {
if (event.event === 'stopped' || event.event === 'exit') {
const toRemove = this.debugService.getModel().getBreakpoints()
.filter(bp => bp.lineNumber === lineNumber && bp.source.uri.toString() === uri.toString()).pop();
this.debugService.removeBreakpoints(toRemove.getId());
oneTimeListener.dispose();
}
});
return this.debugService.addBreakpoints([{ uri, lineNumber }]).then(() => {

View file

@ -135,10 +135,6 @@ class MockRawSession implements debug.IRawDebugSession {
};
}
public get onDidStop(): Event<DebugProtocol.StoppedEvent> {
return null;
}
public get onDidEvent(): Event<DebugProtocol.Event> {
return null;
}