summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorJeremy Huddleston <[email protected]>2012-04-27 18:36:33 -0700
committerJeremy Huddleston <[email protected]>2012-05-16 18:58:30 -0700
commitd65bd195ecbd6623b962a3c98725a484ef2791a8 (patch)
tree4bc99dac9f1c085af752001e0b0786e3f20272c1 /src/glx
parenta73a800b3200d21c32fac9f28e2f86919bc0a2ba (diff)
darwin: Eliminate a possible race condition while destroying a surface
Introduced by: c60ffd2840036af1ea6f2b6c6e1e9014bb8e2c34 Signed-off-by: Jeremy Huddleston <[email protected]>
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/apple/apple_glx_surface.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/glx/apple/apple_glx_surface.c b/src/glx/apple/apple_glx_surface.c
index d42fa3b3269..915520286b0 100644
--- a/src/glx/apple/apple_glx_surface.c
+++ b/src/glx/apple/apple_glx_surface.c
@@ -207,9 +207,6 @@ apple_glx_surface_destroy(unsigned int uid)
d->types.surface.pending_destroy = true;
d->release(d);
- /* apple_glx_drawable_find_by_uid returns a locked drawable */
- d->unlock(d);
-
/*
* We release 2 references to the surface. One was acquired by
* the find, and the other was leftover from a context, or
@@ -220,6 +217,9 @@ apple_glx_surface_destroy(unsigned int uid)
* to actually destroy it when the pending_destroy is processed
* by a glViewport callback (see apple_glx_context_update()).
*/
- d->destroy(d);
+ if (!d->destroy(d)) {
+ /* apple_glx_drawable_find_by_uid returns a locked drawable */
+ d->unlock(d);
+ }
}
}