Skip to content

Commit

Permalink
Fixes #7366 Remove leaked breakpoint after stopping with run-to-cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Munoz committed Jun 15, 2016
1 parent 9b767f9 commit d377857
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
5 changes: 0 additions & 5 deletions src/vs/workbench/parts/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
}

Expand Down
12 changes: 7 additions & 5 deletions src/vs/workbench/parts/debug/electron-browser/debugActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
4 changes: 0 additions & 4 deletions src/vs/workbench/parts/debug/test/common/mockDebugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d377857

Please sign in to comment.