[pango/threadsafe-failed-attempt: 6/11] Don't dispose cf_priv->data when we are done with it
- From: Behdad Esfahbod <behdad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/threadsafe-failed-attempt: 6/11] Don't dispose cf_priv->data when we are done with it
- Date: Thu, 15 Nov 2012 19:18:05 +0000 (UTC)
commit 16169eec0dcb3d32ae456c5a16c82056e35dc28b
Author: Behdad Esfahbod <behdad behdad org>
Date: Mon Oct 15 20:02:56 2012 -0500
Don't dispose cf_priv->data when we are done with it
Is racy, can cause crashes when one thread disposes it while another
is still using it.
pango/pangocairo-font.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 57b6dd1..67fdcf1 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -67,10 +67,7 @@ _pango_cairo_font_private_get_scaled_font (PangoCairoFontPrivate *cf_priv)
retry:
scaled_font = g_atomic_pointer_get (&cf_priv->scaled_font);
- /* The case of scaled_font == NULL && data == NULL happens when we tried to
- * create it, and failed before. */
- if (G_UNLIKELY (!scaled_font) &&
- ((data = g_atomic_pointer_get (&cf_priv->data)) != NULL))
+ if (G_UNLIKELY (!scaled_font))
{
cairo_font_face_t *font_face;
font_face = (* PANGO_CAIRO_FONT_GET_IFACE (cf_priv->cfont)->create_font_face) (cf_priv->cfont);
@@ -89,9 +86,6 @@ retry:
goto retry;
}
- if (g_atomic_pointer_compare_and_exchange (&cf_priv->data, data, NULL))
- _pango_cairo_font_private_scaled_font_data_destroy (data);
-
if (G_UNLIKELY (!scaled_font || cairo_scaled_font_status (scaled_font) != CAIRO_STATUS_SUCCESS))
{
cairo_scaled_font_t *scaled_font = cf_priv->scaled_font;
@@ -586,7 +580,7 @@ _pango_cairo_font_private_initialize (PangoCairoFontPrivate *cf_priv,
cf_priv->cfont = cfont;
cf_priv->gravity = gravity;
- cf_priv->data = _pango_cairo_font_private_scaled_font_data_create ();
+ cf_priv->data = _pango_cairo_font_private_scaled_font_data_create ();
/* first apply gravity rotation, then font_matrix, such that
* vertical italic text comes out "correct". we don't do anything
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]