[gtksourceview] Fixed crasher bug in incorrect inserting new regions
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtksourceview] Fixed crasher bug in incorrect inserting new regions
- Date: Sun, 15 Nov 2009 16:36:50 +0000 (UTC)
commit 3a6c9129839a1266c8a8b6594b287cdf8c555b35
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Sun Nov 15 17:36:42 2009 +0100
Fixed crasher bug in incorrect inserting new regions
This is a follow up on the previous patch. This time, it fixes the part where
new regions are inserted. Before they were prepended, but this is clearly
wrong since regions need to be inserted at the right location.
.../words/gtksourcecompletionwordsbuffer.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c b/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
index 307013b..68c9d52 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
@@ -404,6 +404,7 @@ add_scan_region (GtkSourceCompletionWordsBuffer *buffer,
GList *item;
GList *merge_start = NULL;
GList *merge_end = NULL;
+ GList *insert_after = NULL;
gint line_count = gtk_text_buffer_get_line_count (buffer->priv->buffer);
@@ -421,6 +422,11 @@ add_scan_region (GtkSourceCompletionWordsBuffer *buffer,
{
ScanRegion *region = (ScanRegion *)item->data;
+ if (region->end < end)
+ {
+ insert_after = item;
+ }
+
/* Check if this region is overlapping, or directly adjacent to,
the new region */
if (start <= region->end + 1 &&
@@ -449,8 +455,9 @@ add_scan_region (GtkSourceCompletionWordsBuffer *buffer,
{
/* Simply prepend, there was no overlap */
buffer->priv->scan_regions =
- g_list_prepend (buffer->priv->scan_regions,
- scan_region_new (start, end));
+ g_list_insert_before (buffer->priv->scan_regions,
+ g_list_next (insert_after),
+ scan_region_new (start, end));
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]