summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-06-10 13:19:08 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-06-10 13:20:26 -0400
commit357204a20fb2ab5ceb5395b3b58acc35b42f69b8 (patch)
treea4a7705a44de4ce9db66cd3c8c0ea080f2f92ffd
parent4b5e25a22cc0bb10c60cd43bef394e16f4a11846 (diff)
downloadpango-357204a20fb2ab5ceb5395b3b58acc35b42f69b8.tar.gz
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.
-rw-r--r--pango/pango-attributes.c12
1 files 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. */