[pango/pango2: 66/168] hbfamily: Unset face families




commit c45339636d9df729f2cfa13e273d182b36139d6b
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 7096104e..f059471b 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]