summaryrefslogtreecommitdiff
path: root/src/cairo-surface-snapshot-private.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-04-27 12:39:40 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-04-27 14:10:50 +0100
commit7eb33099d34234dcccb8f96caba94b38fa385f16 (patch)
tree60dc97ad4280107987751a09ca7a85d5eb724ca2 /src/cairo-surface-snapshot-private.h
parent455b4de1fc6be05f985b43c2f8f83eeed2b2a191 (diff)
snapshot: Perform the cow under a mutex
In order to prevent a race between concurrent destroy and use in another thread, we need to acquire a reference to the snapshot->target under a mutex. Whilst we hold that reference, it prevents the internal destroy mechanism from freeing the memory we are using (if we have a pointer to the original surface) and the client drops their final reference. Oh boy, talk about opening a can of worms... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-surface-snapshot-private.h')
-rw-r--r--src/cairo-surface-snapshot-private.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cairo-surface-snapshot-private.h b/src/cairo-surface-snapshot-private.h
index 4c3369ba..58bee7b4 100644
--- a/src/cairo-surface-snapshot-private.h
+++ b/src/cairo-surface-snapshot-private.h
@@ -36,12 +36,14 @@
#ifndef CAIRO_SURFACE_SNAPSHOT_PRIVATE_H
#define CAIRO_SURFACE_SNAPSHOT_PRIVATE_H
+#include "cairo-mutex-private.h"
#include "cairo-surface-private.h"
#include "cairo-surface-backend-private.h"
struct _cairo_surface_snapshot {
cairo_surface_t base;
+ cairo_mutex_t mutex;
cairo_surface_t *target;
cairo_surface_t *clone;
};