Summary: | Segfault with cairo_pattern_set_user_data | ||
---|---|---|---|
Product: | cairo | Reporter: | Yevgen Muntyan <muntyan> |
Component: | general | Assignee: | Carl Worth <cworth> |
Status: | RESOLVED FIXED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | critical | ||
Priority: | medium | ||
Version: | 1.5.1 | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | test case |
Description
Yevgen Muntyan
2007-08-05 22:00:10 UTC
Created attachment 11002 [details]
test case
The bug is quite obvious. We're creating a copy of the pattern without also copying the user_data array. I wonder if there aren't similar problems stemming from the time user_data was added to most user-visible objects, (though many of them might not have copy functions). There are definitely some additions needed to the test suite here. (More after breakfast...) -Carl If we are copying the pattern we probably should not copy the user-data array, right? (In reply to comment #3) > If we are copying the pattern we probably should not copy the user-data array, > right? Indeed not. Here's a patch (that I just pushed). And no, I will not be bothered to make any bugzilla attachments. :-) -Carl commit 13cae8b5e6d3fc93c4eb1853b91ba356b572b551 Author: Carl Worth <cworth@cworth.org> Date: Mon Aug 6 11:06:47 2007 -0700 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 diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 24efa34..2fd1c87 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; } |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.