diff options
author | Carl Worth <cworth@cworth.org> | 2008-04-11 13:48:38 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2008-04-11 14:09:15 -0700 |
commit | 8f1c8d4b26d6da11101c51ef388d1dcc7177cfb4 (patch) | |
tree | 2fd933903c4e91737fec57591d97a62ba2efee1e | |
parent | a5770c3335fccd1591f2cd58ab950a6eba77f271 (diff) |
Revert "[xlib] Add locking around GC cache."
This reverts commit 9cfd82e87b60c0d65e9cafda026cb9a498874575.
The fix was broken as it introduced crashes by calling
XSetClipMask with a NULL GC, (basically a reintroduction
of the bug originally fixed here:
7802de6d5edaf998c98b141870dc2c6b4c0f3e91
Let's revert for sake of the release, and fix this correctly
on master.
-rw-r--r-- | src/cairo-xlib-private.h | 1 | ||||
-rw-r--r-- | src/cairo-xlib-screen.c | 31 |
2 files changed, 10 insertions, 22 deletions
diff --git a/src/cairo-xlib-private.h b/src/cairo-xlib-private.h index 2d9737d93..5bfc2ec56 100644 --- a/src/cairo-xlib-private.h +++ b/src/cairo-xlib-private.h @@ -79,7 +79,6 @@ typedef struct _cairo_xlib_visual_info { struct _cairo_xlib_screen_info { cairo_xlib_screen_info_t *next; cairo_reference_count_t ref_count; - cairo_mutex_t mutex; cairo_xlib_display_t *display; Screen *screen; diff --git a/src/cairo-xlib-screen.c b/src/cairo-xlib-screen.c index fc07fda22..8a3da6675 100644 --- a/src/cairo-xlib-screen.c +++ b/src/cairo-xlib-screen.c @@ -256,14 +256,12 @@ _cairo_xlib_screen_info_close_display (cairo_xlib_screen_info_t *info) { int i; - CAIRO_MUTEX_LOCK (info->mutex); for (i = 0; i < ARRAY_LENGTH (info->gc); i++) { if (info->gc[i] != NULL) { XFreeGC (info->display->display, info->gc[i]); info->gc[i] = NULL; } } - CAIRO_MUTEX_UNLOCK (info->mutex); } void @@ -297,8 +295,6 @@ _cairo_xlib_screen_info_destroy (cairo_xlib_screen_info_t *info) _cairo_array_fini (&info->visuals); - CAIRO_MUTEX_FINI (info->mutex); - free (info); } @@ -339,7 +335,6 @@ _cairo_xlib_screen_info_get (Display *dpy, Screen *screen) info = malloc (sizeof (cairo_xlib_screen_info_t)); if (info != NULL) { CAIRO_REFERENCE_COUNT_INIT (&info->ref_count, 2); /* Add one for display cache */ - CAIRO_MUTEX_INIT (info->mutex); info->display = _cairo_xlib_display_reference (display); info->screen = screen; info->has_render = FALSE; @@ -390,18 +385,16 @@ GC _cairo_xlib_screen_get_gc (cairo_xlib_screen_info_t *info, int depth) { GC gc; - cairo_bool_t needs_reset; depth = depth_to_index (depth); - CAIRO_MUTEX_LOCK (info->mutex); gc = info->gc[depth]; info->gc[depth] = NULL; - needs_reset = info->gc_needs_clip_reset & (1 << depth); - CAIRO_MUTEX_UNLOCK (info->mutex); - if (needs_reset) + if (info->gc_needs_clip_reset & (1 << depth)) { XSetClipMask(info->display->display, gc, None); + info->gc_needs_clip_reset &= ~(1 << depth); + } return gc; } @@ -410,25 +403,21 @@ cairo_status_t _cairo_xlib_screen_put_gc (cairo_xlib_screen_info_t *info, int depth, GC gc, cairo_bool_t reset_clip) { cairo_status_t status = CAIRO_STATUS_SUCCESS; - GC oldgc; depth = depth_to_index (depth); - CAIRO_MUTEX_LOCK (info->mutex); - oldgc = info->gc[depth]; + if (info->gc[depth] != NULL) { + status = _cairo_xlib_display_queue_work (info->display, + (cairo_xlib_notify_func) XFreeGC, + info->gc[depth], + NULL); + } + info->gc[depth] = gc; if (reset_clip) info->gc_needs_clip_reset |= 1 << depth; else info->gc_needs_clip_reset &= ~(1 << depth); - CAIRO_MUTEX_UNLOCK (info->mutex); - - if (oldgc != NULL) { - status = _cairo_xlib_display_queue_work (info->display, - (cairo_xlib_notify_func) XFreeGC, - oldgc, - NULL); - } return status; } |