[pango/pango-1-44: 11/31] layout: Fix a crash
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango-1-44: 11/31] layout: Fix a crash
- Date: Sun, 9 May 2021 01:32:01 +0000 (UTC)
commit 800426849efd8a3d1e9d6d26fec3adaa67a50958
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jun 9 11:23:44 2020 -0400
layout: Fix a crash
pango_layout_get_effective_attributes can return
NULL. But not all callers were handling that.
(cherry-picked from commit 1f06c915)
pango/pango-layout.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 16783941..84dfb39f 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3031,17 +3031,22 @@ ensure_tab_width (PangoLayout *layout)
PangoAttribute *attr;
PangoAttrList *layout_attrs;
PangoAttrList *tmp_attrs;
- PangoAttrIterator *iter;
PangoFontDescription *font_desc = pango_font_description_copy_static
(pango_context_get_font_description (layout->context));
- PangoLanguage *language;
+ PangoLanguage *language = NULL;
PangoShapeFlags shape_flags = PANGO_SHAPE_NONE;
if (pango_context_get_round_glyph_positions (layout->context))
shape_flags |= PANGO_SHAPE_ROUND_POSITIONS;
layout_attrs = pango_layout_get_effective_attributes (layout);
- iter = pango_attr_list_get_iterator (layout_attrs);
- pango_attr_iterator_get_font (iter, font_desc, &language, NULL);
+ if (layout_attrs)
+ {
+ PangoAttrIterator *iter;
+
+ iter = pango_attr_list_get_iterator (layout_attrs);
+ pango_attr_iterator_get_font (iter, font_desc, &language, NULL);
+ pango_attr_iterator_destroy (iter);
+ }
tmp_attrs = pango_attr_list_new ();
@@ -3057,7 +3062,6 @@ ensure_tab_width (PangoLayout *layout)
items = pango_itemize (layout->context, " ", 0, 1, tmp_attrs, NULL);
- pango_attr_iterator_destroy (iter);
if (layout_attrs != layout->attrs)
{
pango_attr_list_unref (layout_attrs);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]