clutter-offscreen-effect: Disable if no texture

If texture allocation fails (e.g. on an old GPU with size limit 2048)
then `update_fbo` would return `FALSE` but leaves `priv->offscreen`
as non-NULL. So the next paint will try to use the offscreen with a
`NULL` texture and crashes. The solution is simply to ensure that
`priv->offscreen` is NULL if there is no `priv->texture`, so the default
(non-offscreen) paint path gets used instead.

Bug reported and fix provided by Gert van de Kraats.

https://launchpad.net/bugs/1795774


(cherry picked from commit f31cf0c3ef)
This commit is contained in:
Daniel van Vugt 2018-10-11 07:02:05 +00:00 committed by Marco Trevisan
parent 6a6d477d71
commit 1b78ca8c5e

View File

@ -186,6 +186,12 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
priv->texture = NULL; priv->texture = NULL;
} }
if (priv->offscreen != NULL)
{
cogl_handle_unref (priv->offscreen);
priv->offscreen = NULL;
}
priv->texture = priv->texture =
clutter_offscreen_effect_create_texture (self, fbo_width, fbo_height); clutter_offscreen_effect_create_texture (self, fbo_width, fbo_height);
if (priv->texture == NULL) if (priv->texture == NULL)
@ -196,9 +202,6 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height)
priv->fbo_width = fbo_width; priv->fbo_width = fbo_width;
priv->fbo_height = fbo_height; priv->fbo_height = fbo_height;
if (priv->offscreen != NULL)
cogl_handle_unref (priv->offscreen);
priv->offscreen = cogl_offscreen_new_to_texture (priv->texture); priv->offscreen = cogl_offscreen_new_to_texture (priv->texture);
if (priv->offscreen == NULL) if (priv->offscreen == NULL)
{ {