[pango/wip/baedert/for-master: 59/61] layout: Handle empty attr lists like NULL ones
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/wip/baedert/for-master: 59/61] layout: Handle empty attr lists like NULL ones
- Date: Mon, 8 Jun 2020 17:06:46 +0000 (UTC)
commit e9a9e28ea73426e282111254861ec4d3f40b6f4f
Author: Timm Bäder <mail baedert org>
Date: Fri Apr 17 21:19:04 2020 +0200
layout: Handle empty attr lists like NULL ones
I.e. don't invalidate the layout if setting from empty to empty.
pango/pango-attributes.c | 2 +-
pango/pango-layout.c | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 1e3cb519..c786df9e 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1903,7 +1903,7 @@ pango_attr_list_equal (PangoAttrList *list,
gboolean
_pango_attr_list_has_attributes (const PangoAttrList *list)
{
- return (list->attributes2 != NULL && list->attributes2->len > 0);
+ return list && (list->attributes2 != NULL && list->attributes2->len > 0);
}
G_DEFINE_BOXED_TYPE (PangoAttrIterator,
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 11e14418..b85f26c1 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -685,7 +685,13 @@ pango_layout_set_attributes (PangoLayout *layout,
g_return_if_fail (layout != NULL);
- if (!attrs && !layout->attrs)
+ /* Both empty */
+ if (!layout->attrs && !attrs)
+ return;
+
+ /* Both empty */
+ if (!_pango_attr_list_has_attributes (layout->attrs) &&
+ !_pango_attr_list_has_attributes (attrs))
return;
old_attrs = layout->attrs;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]