[pango/fix-attr-lists] Fix pango_attr_list_change
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/fix-attr-lists] Fix pango_attr_list_change
- Date: Wed, 10 Jun 2020 17:20:04 +0000 (UTC)
commit 5a5e587e67b582793a57f63baaf2bfbf309f2512
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jun 10 13:19:08 2020 -0400
Fix pango_attr_list_change
There were some breakage introduced in the porting
to GPtrArray - we sometimes ran into assertions, and
sometimes forgot to add the new attribute altogether.
pango/pango-attributes.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 239fc935..800c2dec 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1531,7 +1531,7 @@ pango_attr_list_change (PangoAttrList *list,
g_return_if_fail (list != NULL);
- if (start_index == end_index) /* empty, nothing to do */
+ if (start_index == end_index) /* empty, nothing to do */
{
pango_attribute_destroy (attr);
return;
@@ -1560,7 +1560,7 @@ pango_attr_list_change (PangoAttrList *list,
continue; /* This attr does not overlap with the new one */
g_assert (tmp_attr->end_index >= start_index);
- g_assert (start_index < tmp_attr->end_index);
+ g_assert (start_index <= tmp_attr->end_index);
if (pango_attribute_equal (tmp_attr, attr))
{
@@ -1571,7 +1571,6 @@ pango_attr_list_change (PangoAttrList *list,
/* We are totally overlapping the previous attribute.
* No action is needed.
*/
- g_ptr_array_remove_index (list->attributes, i);
pango_attribute_destroy (attr);
return;
}
@@ -1607,6 +1606,13 @@ pango_attr_list_change (PangoAttrList *list,
}
}
+ if (i == p)
+ {
+ /* we didn't insert attr yet */
+ pango_attr_list_insert (list, attr);
+ return;
+ }
+
/* We now have the range inserted into the list one way or the
* other. Fix up the remainder */
/* Attention: No i = 0 here. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]