[gnome-builder/wip/chergert/bug1] debugger: do pointer comparison before line compare
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/bug1] debugger: do pointer comparison before line compare
- Date: Thu, 31 Aug 2017 19:49:27 +0000 (UTC)
commit 00654966fdaa689bb5c555229aceeb0a929394aa
Author: Christian Hergert <chergert redhat com>
Date: Thu Aug 31 12:49:05 2017 -0700
debugger: do pointer comparison before line compare
libide/debugger/ide-debugger-breakpoints.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/libide/debugger/ide-debugger-breakpoints.c b/libide/debugger/ide-debugger-breakpoints.c
index 1c29f98..ab67360 100644
--- a/libide/debugger/ide-debugger-breakpoints.c
+++ b/libide/debugger/ide-debugger-breakpoints.c
@@ -335,7 +335,28 @@ _ide_debugger_breakpoints_remove (IdeDebuggerBreakpoints *self,
IDE_TRACE_MSG ("removing breakpoint at line %d [breakpoints=%p]",
line, self);
- ide_debugger_breakpoints_set_line (self, line, IDE_DEBUGGER_BREAK_NONE, NULL);
+ if (self->lines != NULL)
+ {
+ /* First try to get things by pointer address to reduce chances
+ * of removing the wrong breakpoint from the collection.
+ */
+ for (guint i = 0; i < self->lines->len; i++)
+ {
+ const LineInfo *info = &g_array_index (self->lines, LineInfo, i);
+
+ /* FIXME: Maybe we should use ide_debugger_breakpoint_compare() here
+ * and ensure that it falls back to file+line/function compare.
+ */
+ if (info->breakpoint == breakpoint)
+ {
+ g_array_remove_index (self->lines, i);
+ g_signal_emit (self, signals [CHANGED], 0);
+ IDE_EXIT;
+ }
+ }
+
+ ide_debugger_breakpoints_set_line (self, line, IDE_DEBUGGER_BREAK_NONE, NULL);
+ }
IDE_EXIT;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]