[pango/pango2-windows: 84/130] hbfamily: Unset face families




commit d4ce33920a4df250fb5326eabaf5ab5182ced3ad
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 11 11:42:08 2022 -0400

    hbfamily: Unset face families
    
    Face objects may outlive their families.
    Make sure to not leave dangling pointers
    behind when that happens.

 pango/pango-hbfamily.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/pango/pango-hbfamily.c b/pango/pango-hbfamily.c
index 7096104e1..f059471b7 100644
--- a/pango/pango-hbfamily.c
+++ b/pango/pango-hbfamily.c
@@ -133,6 +133,12 @@ pango_hb_family_finalize (GObject *object)
 {
   PangoHbFamily *self = PANGO_HB_FAMILY (object);
 
+  for (int i = 0; i < self->faces->len; i++)
+    {
+      PangoHbFace *face = g_ptr_array_index (self->faces, i);
+      ((CommonFace *)face)->family = NULL;
+    }
+
   g_ptr_array_unref (self->faces);
 
   G_OBJECT_CLASS (pango_hb_family_parent_class)->finalize (object);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]