[pango] Bug 586814 – Crashes related to fontmap destruction after upgrade



commit f868f085dd22f74ea43426d21b13165ebcd091b4
Author: Behdad Esfahbod <behdad behdad org>
Date:   Wed Jun 24 22:12:37 2009 -0400

    Bug 586814 â?? Crashes related to fontmap destruction after upgrade
    
    Avoid modifying hashtable while walking it.

 pango/pangofc-fontmap.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 4db6215..4f7c8db 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -1209,6 +1209,7 @@ pango_fc_font_map_add (PangoFcFontMap *fcfontmap,
 }
 
 /* Remove mapping from fcfont->key to fcfont */
+/* Closely related to shutdown_font() */
 void
 _pango_fc_font_map_remove (PangoFcFontMap *fcfontmap,
 			   PangoFcFont    *fcfont)
@@ -1973,17 +1974,20 @@ pango_fc_font_map_create_context (PangoFcFontMap *fcfontmap)
   return pango_font_map_create_context (PANGO_FONT_MAP (fcfontmap));
 }
 
+/* Closely related to _pango_fc_font_map_remove() */
 static void
-shutdown_font (gpointer        key G_GNUC_UNUSED,
+shutdown_font (gpointer        key,
 	       PangoFcFont    *fcfont,
 	       PangoFcFontMap *fcfontmap)
 {
   _pango_fc_font_shutdown (fcfont);
 
-  /* While _pango_fc_font_shutdown() tries to call the following
-   * function, it's too late as the fontmap weakref has already
-   * NULL'ed fcfont->fontmap, so we do it ourselves. */
-  _pango_fc_font_map_remove (fcfontmap, fcfont);
+  /* While _pango_fc_font_shutdown() tries to call
+   * _pango_fc_font_map_remove(), it's too late as the fontmap
+   * weakref has already NULL'ed fcfont->fontmap, so we cleanup
+   * ourselves. */
+  _pango_fc_font_set_font_key (fcfont, NULL);
+  pango_fc_font_key_free (key);
 }
 
 /**



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