summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2017-07-27 16:02:28 -0400
committerAdam Jackson <ajax@redhat.com>2017-12-20 15:20:43 -0500
commit0a73e7bf10d5a9373be5f057fd583c8a5e8e511f (patch)
tree6c6300d53b9288c3618552ee9fbd34522ad9826d
parent06d1c83d04a53f506ae3c8c3c86df5ae779b9ca9 (diff)
composite: Make compIsAlternateVisual safe even if Composite is off
As of ea483af9 we're calling this unconditionally from the GLX code so the synthetic visual is in a lower select group. If Composite has been disabled then GetCompScreen() will return NULL, and this would crash. Rather than force the caller to check first, just always return FALSE if Composite is disabled (which is correct, since none of the visuals will be synthetic in that case). Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com> (cherry picked from commit f80119120c487581ac050ce741808f7c8f438f35)
-rw-r--r--composite/compwindow.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/composite/compwindow.c b/composite/compwindow.c
index 367f23eb7..f88238146 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -326,7 +326,7 @@ compIsAlternateVisual(ScreenPtr pScreen, XID visual)
CompScreenPtr cs = GetCompScreen(pScreen);
int i;
- for (i = 0; i < cs->numAlternateVisuals; i++)
+ for (i = 0; cs && i < cs->numAlternateVisuals; i++)
if (cs->alternateVisuals[i] == visual)
return TRUE;
return FALSE;