diff options
author | Daniel van Vugt <daniel.van.vugt@canonical.com> | 2018-10-11 15:02:05 +0800 |
---|---|---|
committer | Jonas Ã…dahl <jadahl@gmail.com> | 2018-11-08 10:18:25 +0000 |
commit | f31cf0c3ef99b27c0b2c0161fc9fc1eb82778b2e (patch) | |
tree | 40e3ec8eb68c61c0e73d25864d8742c5039f9084 | |
parent | d21478b0f0163b0688abe065a7009b33453d0d00 (diff) | |
download | mutter-f31cf0c3ef99b27c0b2c0161fc9fc1eb82778b2e.tar.gz |
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
-rw-r--r-- | clutter/clutter/clutter-offscreen-effect.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c index e23870f42..b612b0494 100644 --- a/clutter/clutter/clutter-offscreen-effect.c +++ b/clutter/clutter/clutter-offscreen-effect.c @@ -184,6 +184,12 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height) priv->texture = NULL; } + if (priv->offscreen != NULL) + { + cogl_handle_unref (priv->offscreen); + priv->offscreen = NULL; + } + priv->texture = clutter_offscreen_effect_create_texture (self, fbo_width, fbo_height); if (priv->texture == NULL) @@ -194,9 +200,6 @@ update_fbo (ClutterEffect *effect, int fbo_width, int fbo_height) priv->fbo_width = fbo_width; priv->fbo_height = fbo_height; - if (priv->offscreen != NULL) - cogl_handle_unref (priv->offscreen); - priv->offscreen = cogl_offscreen_new_to_texture (priv->texture); if (priv->offscreen == NULL) { |