mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 13:28:03 +02:00
xcb: Fix a crash when finishing a device
The xcb backend uses caches for linear, radial and surface patterns so that it doesn't have to create a new cairo_xcb_picture_t on every use. Whenever any picture is finished, the surface pattern cache is checked on whether it still contains that picture. This means that we cannot destroy the surface_pattern_cache until after the linear and radial_pattern_cache are destroyed or else we'll be querying the surface pattern cache after it was finished. This wasn't noticed before because _cairo_xcb_picture_finish couldn't acquire the cairo_xcb_connection_t and thus failed earlier. The previous commit changed this and now lots of tests in the test suite trigger the crash. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
ae669fb8ab
commit
050a877a9e
1 changed files with 4 additions and 1 deletions
|
|
@ -68,9 +68,12 @@ _cairo_xcb_screen_finish (cairo_xcb_screen_t *screen)
|
|||
for (i = 0; i < ARRAY_LENGTH (screen->stock_colors); i++)
|
||||
cairo_surface_destroy (screen->stock_colors[i]);
|
||||
|
||||
_cairo_cache_fini (&screen->surface_pattern_cache);
|
||||
_cairo_cache_fini (&screen->linear_pattern_cache);
|
||||
_cairo_cache_fini (&screen->radial_pattern_cache);
|
||||
/* Do this one last, because the above two will cause picture_t
|
||||
* to be finished. This results in a call to ..._remove_surface_picture
|
||||
* which uses the surface pattern cache. */
|
||||
_cairo_cache_fini (&screen->surface_pattern_cache);
|
||||
_cairo_freelist_fini (&screen->pattern_cache_entry_freelist);
|
||||
|
||||
cairo_device_finish (screen->device);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue