[gnome-builder] history: be safer about buffer/mark access
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] history: be safer about buffer/mark access
- Date: Wed, 6 Sep 2017 02:36:48 +0000 (UTC)
commit 1af0fec8f9a55ceab52aa18c1f3fa5229704a64b
Author: Christian Hergert <chergert redhat com>
Date: Tue Sep 5 19:34:52 2017 -0700
history: be safer about buffer/mark access
plugins/history/gbp-history-item.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/plugins/history/gbp-history-item.c b/plugins/history/gbp-history-item.c
index 3e4bc8a..f1ce4a4 100644
--- a/plugins/history/gbp-history-item.c
+++ b/plugins/history/gbp-history-item.c
@@ -102,12 +102,15 @@ gboolean
gbp_history_item_chain (GbpHistoryItem *self,
GbpHistoryItem *other)
{
+ GtkTextBuffer *buffer;
+
g_return_val_if_fail (GBP_IS_HISTORY_ITEM (self), FALSE);
g_return_val_if_fail (GBP_IS_HISTORY_ITEM (other), FALSE);
- if (gtk_text_mark_get_buffer (self->mark) == gtk_text_mark_get_buffer (other->mark))
+ if (self->mark != NULL && other->mark != NULL &&
+ NULL != (buffer = gtk_text_mark_get_buffer (self->mark)) &&
+ buffer == gtk_text_mark_get_buffer (other->mark))
{
- GtkTextBuffer *buffer = gtk_text_mark_get_buffer (self->mark);
GtkTextIter self_iter;
GtkTextIter other_iter;
@@ -119,6 +122,14 @@ gbp_history_item_chain (GbpHistoryItem *self,
return TRUE;
}
+ if (self->file != NULL &&
+ other->file != NULL &&
+ g_file_equal (self->file, other->file))
+ {
+ if (ABS ((gint)self->line - (gint)other->line) < DISTANCE_LINES_THRESH)
+ return TRUE;
+ }
+
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]