Skip to content

Commit

Permalink
Xephyr: Check screen resources creation success
Browse files Browse the repository at this point in the history
If the screen pixmap or the corresponding texture creation with glamor
fails, exit cleanly with an error message instead of segfaulting.

Fixes: https://bugzilla.redhat.com/1431633
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
  • Loading branch information
ofourdan authored and nwnk committed Mar 15, 2017
1 parent f40ff18 commit b0ce1d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hw/kdrive/ephyr/ephyr.c
Expand Up @@ -725,8 +725,10 @@ ephyrCreateResources(ScreenPtr pScreen)
ephyrShadowUpdate, ephyrWindowLinear);
else {
#ifdef GLAMOR
if (ephyr_glamor)
ephyr_glamor_create_screen_resources(pScreen);
if (ephyr_glamor) {
if (!ephyr_glamor_create_screen_resources(pScreen))
return FALSE;
}
#endif
return ephyrSetInternalDamage(pScreen);
}
Expand Down
5 changes: 5 additions & 0 deletions hw/kdrive/ephyr/hostx.c
Expand Up @@ -1559,13 +1559,18 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
pScreen->height,
pScreen->rootDepth,
GLAMOR_CREATE_NO_LARGE);
if (!screen_pixmap)
return FALSE;

pScreen->SetScreenPixmap(screen_pixmap);
if (pScreen->root && pScreen->SetWindowPixmap)
TraverseTree(pScreen->root, ephyrSetPixmapVisitWindow, old_screen_pixmap);

/* Tell the GLX code what to GL texture to read from. */
tex = glamor_get_pixmap_texture(screen_pixmap);
if (!tex)
return FALSE;

ephyr_glamor_set_texture(scrpriv->glamor, tex);

return TRUE;
Expand Down

0 comments on commit b0ce1d0

Please sign in to comment.