[mutter/wip/smcv/shell2538-robustness: 2/2] cogl: Defend against empty or unallocated framebuffers
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/smcv/shell2538-robustness: 2/2] cogl: Defend against empty or unallocated framebuffers
- Date: Fri, 3 Apr 2020 09:32:48 +0000 (UTC)
commit c389aadff933c2d4c7fbe4f2b0864832dec40461
Author: Simon McVittie <smcv debian org>
Date: Thu Apr 2 19:30:59 2020 +0100
cogl: Defend against empty or unallocated framebuffers
It isn't immediately obvious that this is impossible, because there's some
"action at a distance" going on with framebuffers that have their size
set lazily, after their textures get allocated; so let's make this a
critical warning rather than crashing.
In particular, this works around a crash when gnome-shell tries to blur a
background that hasn't yet had any space allocated for it - which it seems
is really an actor layout bug, but more robustness seems good to have.
Workaround for <https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2538>.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1172
Signed-off-by: Simon McVittie <smcv debian org>
cogl/cogl/driver/gl/cogl-framebuffer-gl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
index 2848d7183..e4d215ea2 100644
--- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
+++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c
@@ -132,8 +132,8 @@ _cogl_framebuffer_gl_flush_viewport_state (CoglFramebuffer *framebuffer)
{
float gl_viewport_y;
- g_assert (framebuffer->viewport_width >=0 &&
- framebuffer->viewport_height >=0);
+ g_return_if_fail (framebuffer->viewport_width >= 0);
+ g_return_if_fail (framebuffer->viewport_height >= 0);
/* Convert the Cogl viewport y offset to an OpenGL viewport y offset
* NB: OpenGL defines its window and viewport origins to be bottom
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]