[cairo-commit] cairo/src cairo-atsui-font.c, 1.10, 1.11 cairo-font.c, 1.48, 1.49 cairo-ft-font.c, 1.62, 1.63 cairo-glitz-surface.c, 1.42, 1.43 cairo-path-data.c, 1.5, 1.6 cairo-pdf-surface.c, 1.40, 1.41 cairo-win32-font.c, 1.19, 1.20

Carl Worth commit at pdx.freedesktop.org
Fri Jun 3 16:45:50 PDT 2005


Committed by: cworth

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

Modified Files:
	cairo-atsui-font.c cairo-font.c cairo-ft-font.c 
	cairo-glitz-surface.c cairo-path-data.c cairo-pdf-surface.c 
	cairo-win32-font.c 
Log Message:

        * src/cairo-font.c: (cairo_font_face_reference),
        (cairo_font_face_destroy), (_cairo_simple_font_face_destroy),
        (_cairo_unscaled_font_reference), (_cairo_unscaled_font_destroy),
        (cairo_scaled_font_reference), (cairo_scaled_font_destroy):
        * src/cairo-ft-font.c: (_ft_font_cache_destroy_cache),
        (_cairo_ft_unscaled_font_destroy), (_ft_font_face_destroy):
        * src/cairo-glitz-surface.c: (_cairo_glitz_area_destroy):
        * src/cairo-path-data.c: (cairo_path_destroy):
        * src/cairo-pdf-surface.c: (cairo_pdf_font_destroy),
        (cairo_pdf_ft_font_destroy):
        * src/cairo-win32-font.c: (_cairo_win32_scaled_font_destroy):
        Allow NULL as a valid value for several objects. That is, calling
        reference or destroy on these objects will simply do nothing,
        successfully.

        * src/cairo-atsui-font.c: (_cairo_atsui_font_destroy_font): Remove
        extra whitespace.


Index: cairo-atsui-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-atsui-font.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cairo-atsui-font.c	3 Jun 2005 21:51:57 -0000	1.10
+++ cairo-atsui-font.c	3 Jun 2005 23:45:47 -0000	1.11
@@ -209,7 +209,6 @@
 {
     cairo_atsui_font_t *font = abstract_font;
 
-
     if (font == NULL)
         return;
 

Index: cairo-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-font.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- cairo-font.c	3 Jun 2005 23:16:44 -0000	1.48
+++ cairo-font.c	3 Jun 2005 23:45:47 -0000	1.49
@@ -53,15 +53,19 @@
 
 /**
  * cairo_font_face_reference:
- * @font_face: a #cairo_font_face_t
+ * @font_face: a #cairo_font_face_t, (may be NULL in which case this
+ * function does nothing).
  * 
  * Increases the reference count on @font_face by one. This prevents
- * @font_face from being destroyed until a matching call to cairo_font_face_destroy() 
- * is made.
+ * @font_face from being destroyed until a matching call to
+ * cairo_font_face_destroy() is made.
  **/
 void
 cairo_font_face_reference (cairo_font_face_t *font_face)
 {
+    if (font_face == NULL)
+	return;
+
     font_face->refcount++;
 }
 
@@ -76,6 +80,9 @@
 void
 cairo_font_face_destroy (cairo_font_face_t *font_face)
 {
+    if (font_face == NULL)
+	return;
+
     if (--(font_face->refcount) > 0)
 	return;
 
@@ -327,6 +334,9 @@
     cairo_cache_t *cache;
     cairo_simple_cache_key_t key;
 
+    if (simple_face == NULL)
+	return;
+
     _lock_global_simple_cache ();
     cache = _get_global_simple_cache ();
     assert (cache);
@@ -847,12 +857,18 @@
 void
 _cairo_unscaled_font_reference (cairo_unscaled_font_t *unscaled_font)
 {
+    if (unscaled_font == NULL)
+	return;
+
     unscaled_font->refcount++;
 }
 
 void
 _cairo_unscaled_font_destroy (cairo_unscaled_font_t *unscaled_font)
 {    
+    if (unscaled_font == NULL)
+	return;
+
     if (--(unscaled_font->refcount) > 0)
 	return;
 
@@ -867,7 +883,8 @@
 
 /**
  * cairo_scaled_font_reference:
- * @scaled_font: a #cairo_scaled_font_t
+ * @scaled_font: a #cairo_scaled_font_t, (may be NULL in which case
+ * this function does nothing)
  * 
  * Increases the reference count on @scaled_font by one. This prevents
  * @scaled_font from being destroyed until a matching call to
@@ -876,6 +893,9 @@
 void
 cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font)
 {
+    if (scaled_font == NULL)
+	return;
+
     scaled_font->refcount++;
 }
 
@@ -893,6 +913,9 @@
     cairo_font_cache_key_t key;
     cairo_cache_t *cache;
 
+    if (scaled_font == NULL)
+	return;
+
     if (--(scaled_font->refcount) > 0)
 	return;
 

Index: cairo-ft-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- cairo-ft-font.c	3 Jun 2005 21:51:57 -0000	1.62
+++ cairo-ft-font.c	3 Jun 2005 23:45:47 -0000	1.63
@@ -256,6 +256,7 @@
 _ft_font_cache_destroy_cache (void *cache)
 {
     ft_cache_t *fc = (ft_cache_t *) cache;
+
     FT_Done_FreeType (fc->lib);
     free (fc);
 }
@@ -482,6 +483,9 @@
 {
     ft_unscaled_font_t *unscaled  = abstract_font;
 
+    if (unscaled == NULL)
+	return;
+
     if (unscaled->from_face) {
 	/* See comments in _ft_font_face_destroy about the "zombie" state
 	 * for a _ft_font_face.
@@ -1340,6 +1344,9 @@
     ft_font_face_t *tmp_face = NULL;
     ft_font_face_t *last_face = NULL;
 
+    if (font_face == NULL)
+	return;
+
     /* When destroying the face created by cairo_ft_font_face_create_for_ft_face,
      * we have a special "zombie" state for the face when the unscaled font
      * is still alive but there are no public references to the font face.

Index: cairo-glitz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-glitz-surface.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- cairo-glitz-surface.c	3 Jun 2005 23:08:28 -0000	1.42
+++ cairo-glitz-surface.c	3 Jun 2005 23:45:47 -0000	1.43
@@ -1328,7 +1328,7 @@
 static void
 _cairo_glitz_area_destroy (cairo_glitz_area_t *area)
 {   
-    if (!area)
+    if (area == NULL)
 	return;
 
     if (area->state == CAIRO_GLITZ_AREA_OCCUPIED)

Index: cairo-path-data.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-path-data.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cairo-path-data.c	27 May 2005 00:35:35 -0000	1.5
+++ cairo-path-data.c	3 Jun 2005 23:45:47 -0000	1.6
@@ -364,9 +364,26 @@
     return path;
 }
 
+/**
+ * cairo_path_destroy:
+ * @path: a #cairo_path_t pointer returned from either cairo_copy_path
+ * or cairo_copy_path_flat.
+ * 
+ * Frees @path and all memory associated with it. Upon returning from
+ * this function @path will be pointing to an invalid location which
+ * should not be used.
+ *
+ * The cairo_path_destroy function should only be called with a
+ * pointer to a #cairo_path_t returned by a cairo function. Any
+ * manually created cairo_path_t object should be freed manually as
+ * well.
+ **/
 void
 cairo_path_destroy (cairo_path_t *path)
 {
+    if (path == NULL)
+	return;
+
     free (path->data);
     path->num_data = 0;
     free (path);

Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- cairo-pdf-surface.c	3 Jun 2005 21:51:57 -0000	1.40
+++ cairo-pdf-surface.c	3 Jun 2005 23:45:47 -0000	1.41
@@ -291,6 +291,9 @@
 static void
 cairo_pdf_font_destroy (cairo_pdf_font_t *font)
 {
+    if (font == NULL)
+	return;
+
     font->backend->destroy (font);
 }
 
@@ -378,6 +381,9 @@
 {
     cairo_pdf_ft_font_t *font = abstract_font;
 
+    if (font == NULL)
+	return;
+
     _cairo_unscaled_font_destroy (font->base.unscaled_font);
     free (font->base.base_font);
     free (font->parent_to_subset);

Index: cairo-win32-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-win32-font.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cairo-win32-font.c	3 Jun 2005 21:51:57 -0000	1.19
+++ cairo-win32-font.c	3 Jun 2005 23:45:47 -0000	1.20
@@ -466,6 +466,9 @@
 {
     cairo_win32_scaled_font_t *scaled_font = abstract_font;
 
+    if (scaled_font == NULL)
+	return;
+
     if (scaled_font->scaled_hfont)
 	DeleteObject (scaled_font->scaled_hfont);
 




More information about the cairo-commit mailing list