[cairo-commit] src/cairo.c src/cairo-output-stream.c
Kristian Høgsberg
krh at kemper.freedesktop.org
Tue Apr 11 17:50:21 PDT 2006
src/cairo-output-stream.c | 3 +++
src/cairo.c | 6 ++++++
2 files changed, 9 insertions(+)
New commits:
diff-tree 523f9e46d87392a539c26ade18d99a3db7ed833d (from 6e77a0e248c337bf3f39c0de239a7743c6969efe)
Author: Kristian Høgsberg <krh at dinky.bitplanet.net>
Date: Tue Apr 11 20:49:55 2006 -0400
Make cairo_t and cairo_output_stream_t destructors handle NULL.
All other cairo destructors and reference functions accept and ignore NULL,
so fix up cairo_destroy(), cairo_reference(), and cairo_output_stream_destroy()
to do so too.
diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
index 16d9371..54bc81f 100644
--- a/src/cairo-output-stream.c
+++ b/src/cairo-output-stream.c
@@ -111,6 +111,9 @@ _cairo_output_stream_close (cairo_output
void
_cairo_output_stream_destroy (cairo_output_stream_t *stream)
{
+ if (stream == NULL)
+ return;
+
_cairo_output_stream_close (stream);
free (stream);
}
diff --git a/src/cairo.c b/src/cairo.c
index d0dd4ec..60166f5 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -220,6 +220,9 @@ cairo_create (cairo_surface_t *target)
cairo_t *
cairo_reference (cairo_t *cr)
{
+ if (cr == NULL)
+ return NULL;
+
if (cr->ref_count == (unsigned int)-1)
return cr;
@@ -241,6 +244,9 @@ cairo_reference (cairo_t *cr)
void
cairo_destroy (cairo_t *cr)
{
+ if (cr == NULL)
+ return;
+
if (cr->ref_count == (unsigned int)-1)
return;
More information about the cairo-commit
mailing list