[cairo-commit] cairo/src cairo_surface.c,1.47,1.48

Kristian Hogsberg commit at pdx.freedesktop.org
Wed Mar 16 12:15:31 PST 2005


Committed by: krh

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

Modified Files:
	cairo_surface.c 
Log Message:
2005-03-16  Kristian Høgsberg  <krh at redhat.com>

        * src/cairo_surface.c (_destroy_user_data)
        (cairo_surface_set_user_data): Dont call user data destroy
        function if it's NULL.

        * test/user_data.c: (main): Add test case for user data with NULL
        destroy function.



Index: cairo_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_surface.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- cairo_surface.c	16 Mar 2005 20:08:41 -0000	1.47
+++ cairo_surface.c	16 Mar 2005 20:15:29 -0000	1.48
@@ -149,7 +149,7 @@
     num_slots = surface->user_data_slots.num_elements;
     slots = (cairo_user_data_slot_t *) surface->user_data_slots.elements;
     for (i = 0; i < num_slots; i++) {
-	if (slots[i].user_data != NULL)
+	if (slots[i].user_data != NULL && slots[i].destroy != NULL)
 	    slots[i].destroy (slots[i].user_data);
     }
 
@@ -267,7 +267,7 @@
     slots = (cairo_user_data_slot_t *) surface->user_data_slots.elements;
     for (i = 0; i < num_slots; i++) {
 	if (slots[i].key == key) {
-	    if (slots[i].user_data != NULL)
+	    if (slots[i].user_data != NULL && slots[i].destroy != NULL)
 		slots[i].destroy (slots[i].user_data);
 	    s = &slots[i];
 	    break;




More information about the cairo-commit mailing list