diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-09-17 13:04:36 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-09-17 13:04:36 +0000 |
commit | fc9c3c3628aef1ee0b646b9bd10f47cee1549ec4 (patch) | |
tree | 5d4c3be03991407ffbfd126bd2f38bd502db3d32 /pango | |
parent | 754bd1814d33ff374a4a265bd399549269f2ce06 (diff) | |
parent | 54b593ec3e7829583ce2fec3fe22dff512db07fb (diff) | |
download | pango-fc9c3c3628aef1ee0b646b9bd10f47cee1549ec4.tar.gz |
Merge branch 'fix-nested-attributes' into 'master'
Fix attr iterators with overlapping attributes
See merge request GNOME/pango!240
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pango-attributes.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index 12942043..4f96135b 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -2003,7 +2003,7 @@ pango_attr_iterator_range (PangoAttrIterator *iterator, gboolean pango_attr_iterator_next (PangoAttrIterator *iterator) { - guint i; + int i; g_return_val_if_fail (iterator != NULL, FALSE); @@ -2016,19 +2016,14 @@ pango_attr_iterator_next (PangoAttrIterator *iterator) if (iterator->attribute_stack) { - for (i = 0; i < iterator->attribute_stack->len; i++) + for (i = iterator->attribute_stack->len - 1; i>= 0; i--) { const PangoAttribute *attr = g_ptr_array_index (iterator->attribute_stack, i); if (attr->end_index == iterator->start_index) - { - g_ptr_array_remove_index (iterator->attribute_stack, i); /* Can't use index_fast :( */; - i--; - } + g_ptr_array_remove_index (iterator->attribute_stack, i); /* Can't use index_fast :( */ else - { - iterator->end_index = MIN (iterator->end_index, attr->end_index); - } + iterator->end_index = MIN (iterator->end_index, attr->end_index); } } @@ -2136,14 +2131,14 @@ PangoAttribute * pango_attr_iterator_get (PangoAttrIterator *iterator, PangoAttrType type) { - guint i; + int i; g_return_val_if_fail (iterator != NULL, NULL); if (!iterator->attribute_stack) return NULL; - for (i = 0; i < iterator->attribute_stack->len; i++) + for (i = iterator->attribute_stack->len - 1; i>= 0; i--) { PangoAttribute *attr = g_ptr_array_index (iterator->attribute_stack, i); |