[gspell] InlineCheckerTextBuffer: add more assertions
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gspell] InlineCheckerTextBuffer: add more assertions
- Date: Wed, 22 Feb 2017 15:18:18 +0000 (UTC)
commit 043609960097f80d99ce4c166892b291df06aae3
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Feb 22 16:16:09 2017 +0100
InlineCheckerTextBuffer: add more assertions
Let's see if it fails earlier.
https://bugzilla.gnome.org/show_bug.cgi?id=778883
gspell/gspell-inline-checker-text-buffer.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/gspell/gspell-inline-checker-text-buffer.c b/gspell/gspell-inline-checker-text-buffer.c
index 58ae1b5..73997e4 100644
--- a/gspell/gspell-inline-checker-text-buffer.c
+++ b/gspell/gspell-inline-checker-text-buffer.c
@@ -242,19 +242,36 @@ check_subregion (GspellInlineCheckerTextBuffer *spell,
start,
end);
- word_start = *start;
- if (!_gspell_text_iter_starts_word (&word_start))
+ if (_gspell_text_iter_starts_word (start))
{
- _gspell_text_iter_forward_word_end (&word_start);
+ word_start = *start;
+ }
+ else
+ {
+ GtkTextIter next_word_end;
+
+ /* Based on adjust_iters() code. */
+ g_assert (!_gspell_text_iter_inside_word (start));
- /* Didn't move, there is no words after @start. */
- if (gtk_text_iter_equal (&word_start, start))
+ next_word_end = *start;
+ _gspell_text_iter_forward_word_end (&next_word_end);
+
+ /* Didn't move, there are no words after @start. */
+ if (gtk_text_iter_equal (&next_word_end, start))
{
return;
}
+ g_assert (_gspell_text_iter_ends_word (&next_word_end));
+ g_assert_cmpint (gtk_text_iter_compare (start, &next_word_end), <, 0);
+
+ word_start = next_word_end;
_gspell_text_iter_backward_word_start (&word_start);
g_assert (_gspell_text_iter_starts_word (&word_start));
+
+ /* This assertion has failed in some cases, see:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=778883
+ */
g_assert_cmpint (gtk_text_iter_compare (start, &word_start), <, 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]