glamor: BUG_* checks on NULL atlas

If this happens, we really have a bug, so better spit out a warning
instead of just segfault'ing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-05-14 13:06:35 +02:00
parent b0c9e95a61
commit 016f62baad

View File

@ -126,6 +126,8 @@ glamor_copy_glyph(PixmapPtr glyph_pixmap,
static Bool static Bool
glamor_glyph_atlas_init(ScreenPtr screen, struct glamor_glyph_atlas *atlas) glamor_glyph_atlas_init(ScreenPtr screen, struct glamor_glyph_atlas *atlas)
{ {
BUG_RETURN_VAL(!atlas, FALSE);
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
PictFormatPtr format = atlas->format; PictFormatPtr format = atlas->format;
@ -435,6 +437,7 @@ glamor_composite_glyphs(CARD8 op,
/* Glyph not cached in current atlas? /* Glyph not cached in current atlas?
*/ */
BUG_RETURN(!glyph_atlas);
if (_X_UNLIKELY(glyph_priv->serial != glyph_atlas->serial)) { if (_X_UNLIKELY(glyph_priv->serial != glyph_atlas->serial)) {
if (!glamor_glyph_can_add(glyph_atlas, glyph_atlas_dim, glyph_draw)) { if (!glamor_glyph_can_add(glyph_atlas, glyph_atlas_dim, glyph_draw)) {
if (glyphs_queued) { if (glyphs_queued) {