From 84e2631c19acd6499b2e1cb094a5c98ad738ef71 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 7 Dec 2019 16:47:59 -0500 Subject: [PATCH] Fix removing breakpoints. Sometimes callers to -[BreakpointManager removeBreakpoint:] create a temporary object to remove the breakpoint at a file/line. But that temp object does not have the internal debugger ID. --- Source/BreakpointManager.h | 1 - Source/BreakpointManager.m | 15 ++++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Source/BreakpointManager.h b/Source/BreakpointManager.h index 8537c36..b286496 100644 --- a/Source/BreakpointManager.h +++ b/Source/BreakpointManager.h @@ -29,6 +29,5 @@ - (BOOL)hasBreakpoint:(Breakpoint*)bp; - (NSSet*)breakpointsForFile:(NSString*)file; -- (BOOL)hasBreakpointAt:(NSUInteger)line inFile:(NSString*)file; @end diff --git a/Source/BreakpointManager.m b/Source/BreakpointManager.m index bb53511..2c133f6 100644 --- a/Source/BreakpointManager.m +++ b/Source/BreakpointManager.m @@ -89,9 +89,14 @@ - (Breakpoint*)removeBreakpoint:(Breakpoint*)bp { - if (![_breakpoints containsObject:bp]) + // Use the -isEqual: test to find the object in |_breakpoints| that also has + // the debugger id and secure bookmark data. + NSUInteger idx = [_breakpoints indexOfObject:bp]; + if (idx == NSNotFound) return nil; + bp = [_breakpoints objectAtIndex:idx]; + [self willChangeValueForKey:@"breakpoints"]; [_breakpoints removeObject:bp]; [self didChangeValueForKey:@"breakpoints"]; @@ -128,14 +133,6 @@ return [_breakpoints containsObject:breakpoint]; } -/** - * Checks to see if a given file has a breakpoint on a given line - */ -- (BOOL)hasBreakpointAt:(NSUInteger)line inFile:(NSString*)file -{ - return [self hasBreakpoint:[Breakpoint breakpointAtLine:line inFile:file]]; -} - #pragma mark Private /** -- 2.22.5