summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-10-05 13:36:30 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-10-05 13:36:30 +0100
commitccf694d060dd9ea41939fc1c5847d23d3a422b75 (patch)
tree67ef42ead483a9dec68c8a698d2cc80878702a6a /src
parent8488ae022de45b441f29c3e90e16d5cca3082d20 (diff)
xlib/shm: Discard SHM surfaces upon CloseDisplay
Fixes xlib-surface-source Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/cairo-xlib-surface-shm.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
index a863a3672..08169f21a 100644
--- a/src/cairo-xlib-surface-shm.c
+++ b/src/cairo-xlib-surface-shm.c
@@ -82,6 +82,7 @@ struct _cairo_xlib_shm_info {
struct _cairo_xlib_shm_surface {
cairo_image_surface_t image;
+ cairo_list_t link;
cairo_xlib_shm_info_t *info;
Pixmap pixmap;
unsigned long active;
@@ -109,6 +110,8 @@ struct _cairo_xlib_shm_display {
Window window;
+ cairo_list_t surfaces;
+
cairo_list_t pool;
struct pqueue info;
};
@@ -573,6 +576,8 @@ _cairo_xlib_shm_surface_finish (void *abstract_surface)
_cairo_xlib_shm_pool_cleanup (display);
}
+ cairo_list_del (&shm->link);
+
cairo_device_release (&display->base);
return CAIRO_STATUS_SUCCESS;
}
@@ -682,6 +687,8 @@ _cairo_xlib_shm_surface_create (cairo_xlib_surface_t *other,
assert (shm->active == 0 || will_sync);
+ cairo_list_add (&shm->link, &display->shm->surfaces);
+
cairo_device_release (&display->base);
return shm;
@@ -1153,6 +1160,8 @@ _cairo_xlib_display_init_shm (cairo_xlib_display_t *display)
shm->opcode = codes ->major_opcode;
shm->event = codes->first_event;
+ cairo_list_init (&shm->surfaces);
+
display->shm = shm;
}
@@ -1164,6 +1173,11 @@ _cairo_xlib_display_fini_shm (cairo_xlib_display_t *display)
if (shm == NULL)
return;
+ while (!cairo_list_is_empty (&shm->surfaces))
+ cairo_surface_finish (&cairo_list_first_entry (&shm->surfaces,
+ cairo_xlib_shm_surface_t,
+ link)->image.base);
+
_pqueue_fini (&shm->info);
while (!cairo_list_is_empty (&shm->pool)) {