[gspell] inline-checker-text-buffer: add assertions around check_subregion()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gspell] inline-checker-text-buffer: add assertions around check_subregion()
- Date: Thu, 3 Mar 2016 16:24:08 +0000 (UTC)
commit a4e70b6ed08becdd851fbfd88b523f3bc813f313
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Mar 3 17:22:18 2016 +0100
inline-checker-text-buffer: add assertions around check_subregion()
gspell/gspell-inline-checker-text-buffer.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gspell/gspell-inline-checker-text-buffer.c b/gspell/gspell-inline-checker-text-buffer.c
index fe3f9d0..a7d5468 100644
--- a/gspell/gspell-inline-checker-text-buffer.c
+++ b/gspell/gspell-inline-checker-text-buffer.c
@@ -375,6 +375,8 @@ check_visible_region_in_view (GspellInlineCheckerTextBuffer *spell,
{
GtkTextIter start;
GtkTextIter end;
+ GtkTextIter orig_start;
+ GtkTextIter orig_end;
if (!_gspell_text_region_iterator_get_subregion (&intersect_iter,
&start,
@@ -383,8 +385,18 @@ check_visible_region_in_view (GspellInlineCheckerTextBuffer *spell,
break;
}
+ orig_start = start;
+ orig_end = end;
+
check_subregion (spell, &start, &end);
+ /* Ensure that we don't have an infinite loop. We must subtract
+ * from scan_region at least [start, end], otherwise we will
+ * re-check the same subregion again and again.
+ */
+ g_assert (gtk_text_iter_compare (&start, &orig_start) <= 0);
+ g_assert (gtk_text_iter_compare (&orig_end, &end) <= 0);
+
_gspell_text_region_subtract (spell->scan_region, &start, &end);
_gspell_text_region_iterator_next (&intersect_iter);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]