summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2020-04-02 19:32:18 +0100
committerSimon McVittie <smcv@debian.org>2020-04-03 10:04:26 +0100
commit5a83f003c7ffa1c8a6dc140782dbe6a6cb291c81 (patch)
treeefcb75b9582301a643924fca39e9ae8e717bd875
parent0a4974ac8cf86f209e880514d966a177acdebac2 (diff)
downloadgnome-shell-wip/smcv/issue2538.tar.gz
blur: Always allocate at least one pixelwip/smcv/issue2538
This works around a crash when we try to blur a background that hasn't yet had any space allocated for it, in particular when locking the screen with mutter 3.36.1 and the Native Window Placement extension. Workaround for <https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2538>. Signed-off-by: Simon McVittie <smcv@debian.org>
-rw-r--r--src/shell-blur-effect.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/shell-blur-effect.c b/src/shell-blur-effect.c
index 5e50ab886..1da931542 100644
--- a/src/shell-blur-effect.c
+++ b/src/shell-blur-effect.c
@@ -360,6 +360,18 @@ update_fbo (FramebufferData *data,
float new_width = floorf (width / downscale_factor);
float new_height = floorf (height / downscale_factor);
+ if (G_UNLIKELY (new_width < 1.0f))
+ {
+ g_warning ("%s: Correcting width from %f to 1", G_STRLOC, new_width);
+ new_width = 1.0f;
+ }
+
+ if (G_UNLIKELY (new_height < 1.0f))
+ {
+ g_warning ("%s: Correcting height from %f to 1", G_STRLOC, new_height);
+ new_height = 1.0f;
+ }
+
data->texture = cogl_texture_2d_new_with_size (ctx, new_width, new_height);
if (!data->texture)
return FALSE;