From afda1179721b96e7786260e613a66ffea783ab9b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 6 Aug 2007 11:06:47 -0700 Subject: [PATCH] Ensure that a copied pattern gets its own user_data array This fixes the bug reported here: Segfault with cairo_pattern_set_user_data https://bugs.freedesktop.org/show_bug.cgi?id=11855 (cherry picked from commit 13cae8b5e6d3fc93c4eb1853b91ba356b572b551) --- src/cairo-pattern.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 6ead4b2f3..81dfaf500 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -185,7 +185,9 @@ _cairo_pattern_init_copy (cairo_pattern_t *pattern, } break; } + /* The reference count and user_data array are unique to the copy. */ pattern->ref_count = 1; + _cairo_user_data_array_init (&pattern->user_data); return CAIRO_STATUS_SUCCESS; }