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>
This commit is contained in:
Chris Wilson 2014-03-10 16:38:54 +00:00
parent e1cb028421
commit 955b5de4ba
1 changed files with 5 additions and 9 deletions

View File

@ -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;