summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-03-10 16:38:54 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-03-10 22:12:22 +0000
commit955b5de4ba103fb115ec0b45f9b59eb2628ca3dd (patch)
treeb7c5b7ec3200f6959915c1c02cf028550caa06c4
parente1cb0284218aaf248e251ac0d12fee4bcd3c7650 (diff)
sna/glyph: Release the pixman glyph cache along the error paths
If we lock the glyph cache and then hit an error, we must make sure we release our lock. An easy way would be not to lock when we may err. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_glyphs.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index c72c5e5d..eca0df0e 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -1147,14 +1147,11 @@ glyphs_via_mask(struct sna *sna,
memset(pixmap->devPrivate.ptr, 0, pixmap->devKind*height);
#if HAS_PIXMAN_GLYPHS
if (sna->render.glyph_cache) {
+ pixman_glyph_cache_t *cache = sna->render.glyph_cache;
pixman_glyph_t stack_glyphs[N_STACK_GLYPHS];
pixman_glyph_t *pglyphs = stack_glyphs;
- pixman_glyph_cache_t *cache;
int count, n;
- cache = sna->render.glyph_cache;
- pixman_glyph_cache_freeze(cache);
-
count = 0;
for (n = 0; n < nlist; ++n)
count += list[n].len;
@@ -1164,6 +1161,7 @@ glyphs_via_mask(struct sna *sna,
goto err_pixmap;
}
+ pixman_glyph_cache_freeze(cache);
count = 0;
do {
n = list->len;
@@ -2053,23 +2051,21 @@ glyphs_via_image(struct sna *sna,
memset(pixmap->devPrivate.ptr, 0, pixmap->devKind*height);
#if HAS_PIXMAN_GLYPHS
if (sna->render.glyph_cache) {
+ pixman_glyph_cache_t *cache = sna->render.glyph_cache;
pixman_glyph_t stack_glyphs[N_STACK_GLYPHS];
pixman_glyph_t *pglyphs = stack_glyphs;
- pixman_glyph_cache_t *cache;
int count, n;
- cache = sna->render.glyph_cache;
- pixman_glyph_cache_freeze(cache);
-
count = 0;
for (n = 0; n < nlist; ++n)
count += list[n].len;
if (count > N_STACK_GLYPHS) {
- pglyphs = malloc (count * sizeof(pixman_glyph_t));
+ pglyphs = malloc(count * sizeof(pixman_glyph_t));
if (pglyphs == NULL)
goto err_pixmap;
}
+ pixman_glyph_cache_freeze(cache);
count = 0;
do {
n = list->len;