From a6b05d10da2fe476f46e6dc4ad8a603964735905 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Nov 2015 15:05:11 -0800 Subject: [PATCH] glamor: Fix crashes when the glyph atlas allocation fails. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We already have a fallback path, so we just need to jump to it when we hit the failure. Signed-off-by: Eric Anholt Reviewed-by: Michel Dänzer --- glamor/glamor_composite_glyphs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/glamor/glamor_composite_glyphs.c b/glamor/glamor_composite_glyphs.c index 389c8f440..8692904eb 100644 --- a/glamor/glamor_composite_glyphs.c +++ b/glamor/glamor_composite_glyphs.c @@ -127,6 +127,10 @@ glamor_glyph_atlas_init(ScreenPtr screen, struct glamor_glyph_atlas *atlas) atlas->atlas = glamor_create_pixmap(screen, glamor_priv->glyph_atlas_dim, glamor_priv->glyph_atlas_dim, format->depth, GLAMOR_CREATE_FBO_NO_FBO); + if (!glamor_pixmap_has_fbo(atlas->atlas)) { + glamor_destroy_pixmap(atlas->atlas); + atlas->atlas = NULL; + } atlas->x = 0; atlas->y = 0; atlas->row_height = 0; @@ -420,8 +424,11 @@ glamor_composite_glyphs(CARD8 op, glyph_atlas->atlas = NULL; } } - if (!glyph_atlas->atlas) + if (!glyph_atlas->atlas) { glamor_glyph_atlas_init(screen, glyph_atlas); + if (!glyph_atlas->atlas) + goto bail_one; + } glamor_glyph_add(glyph_atlas, glyph_draw); }