[cairo-commit] cairo/src cairo-ft-font.c,1.110,1.110.2.1

Carl Worth commit at pdx.freedesktop.org
Tue Sep 13 15:41:18 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv15475/src

Modified Files:
      Tag: BRANCH_1_0
	cairo-ft-font.c 
Log Message:

2005-09-13  Carl Worth  <cworth at cworth.org>

        * src/cairo-ft-font.c: (_cairo_ft_scaled_font_text_to_glyphs):
        Expand locking to include all modification of cairo_scaled_font
        and related objects.


Index: cairo-ft-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.110
retrieving revision 1.110.2.1
diff -u -d -r1.110 -r1.110.2.1
--- cairo-ft-font.c	24 Aug 2005 02:52:09 -0000	1.110
+++ cairo-ft-font.c	13 Sep 2005 22:41:16 -0000	1.110.2.1
@@ -1648,29 +1648,27 @@
     cairo_cache_t *cache = NULL;
     cairo_status_t status = CAIRO_STATUS_SUCCESS;
 
+    _cairo_lock_global_image_glyph_cache ();
+    cache = _cairo_get_global_image_glyph_cache ();
+    if (cache == NULL)
+	return CAIRO_STATUS_NO_MEMORY;
+
     _cairo_ft_scaled_font_get_glyph_cache_key (scaled_font, &key);
 
     status = _cairo_utf8_to_ucs4 ((unsigned char*)utf8, -1, &ucs4, num_glyphs);
     if (status)
-	return status;
+	goto CLEANUP_CACHE;
 
     face = cairo_ft_scaled_font_lock_face (&scaled_font->base);
     if (!face) {
 	status = CAIRO_STATUS_NO_MEMORY;
-	goto FAIL1;
-    }
-
-    _cairo_lock_global_image_glyph_cache ();
-    cache = _cairo_get_global_image_glyph_cache ();
-    if (cache == NULL) {
-	status = CAIRO_STATUS_NO_MEMORY;
-	goto FAIL2;
+	goto CLEANUP_UCS4;
     }
 
     *glyphs = (cairo_glyph_t *) malloc ((*num_glyphs) * (sizeof (cairo_glyph_t)));
     if (*glyphs == NULL) {
 	status = CAIRO_STATUS_NO_MEMORY;
-	goto FAIL2;
+	goto CLEANUP_SCALED_FONT_LOCK_FACE;
     }
 
     for (i = 0; i < *num_glyphs; i++)
@@ -1690,15 +1688,16 @@
         y += val->extents.y_advance;
     }
 
- FAIL2:
-    if (cache)
-	_cairo_unlock_global_image_glyph_cache ();
-
+ CLEANUP_SCALED_FONT_LOCK_FACE:
     cairo_ft_scaled_font_unlock_face (&scaled_font->base);
     
- FAIL1:
+ CLEANUP_UCS4:
     free (ucs4);
-    
+
+ CLEANUP_CACHE:
+    if (cache)
+	_cairo_unlock_global_image_glyph_cache ();
+
     return status;
 }
 



More information about the cairo-commit mailing list