vte r2162 - in trunk: . src



Author: behdad
Date: Thu Nov 20 19:48:22 2008
New Revision: 2162
URL: http://svn.gnome.org/viewvc/vte?rev=2162&view=rev

Log:
2008-11-20  Behdad Esfahbod  <behdad gnome org>

        Bug 561713 â crash on font cache cleanup

        * src/vtepangocairo.c (font_info_reference), (font_info_destroy):
        Remove destroy timeout when resurrecting a font info.



Modified:
   trunk/ChangeLog
   trunk/src/vtepangocairo.c

Modified: trunk/src/vtepangocairo.c
==============================================================================
--- trunk/src/vtepangocairo.c	(original)
+++ trunk/src/vtepangocairo.c	Thu Nov 20 19:48:22 2008
@@ -128,16 +128,22 @@
 }
 
 struct font_info {
+	/* lifecycle */
 	int ref_count;
+	guint destroy_timeout; /* only used when ref_count == 0 */
 
+	/* reusable layout set with font and everything */
 	PangoLayout *layout;
 
+	/* cache of character info */
 	struct unichar_info ascii_unichar_info[128];
 	GHashTable *other_unichar_info;
 
+	/* cell metrics */
 	gint width, height, ascent;
 
 #ifdef VTEPANGOCAIRO_PROFILE
+	/* profiling info */
 	int coverage_count[4];
 #endif
 };
@@ -386,6 +392,9 @@
 
 	g_return_val_if_fail (info->ref_count >= 0, info);
 
+	if (info->ref_count == 0)
+		g_source_remove (info->destroy_timeout);
+
 	info->ref_count++;
 
 	return info;
@@ -419,7 +428,9 @@
 		return;
 
 	/* Delay destruction by a few seconds, in case we need it again */
-	g_timeout_add_seconds (30, (GSourceFunc) font_info_destroy_delayed, info);
+	info->destroy_timeout = g_timeout_add_seconds (30,
+						       (GSourceFunc) font_info_destroy_delayed,
+						       info);
 }
 
 static guint



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