[gtk/wip/smcv/wayland-configure-positive-sizes] wayland: Guard against nonsense sizes being configured



commit 46165b52e575cbed5421efe69fc9354de5dffd5c
Author: Simon McVittie <smcv debian org>
Date:   Mon Apr 6 13:33:09 2020 +0100

    wayland: Guard against nonsense sizes being configured
    
    With the fixes from !1638, it shouldn't be possible for this to happen
    any more. However, non-positive sizes make no sense regardless, so if
    this does somehow happen, let's make sure *something* reasonable happens.
    
    The practical result of this assertion being hit is that we emit a
    critical warning and then behave the same as if !1634 had been merged,
    which is known to solve the issue for the submitter.
    
    Signed-off-by: Simon McVittie <smcv debian org>

 gdk/wayland/gdkwindow-wayland.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 6c555443bd..850247366c 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1076,6 +1076,9 @@ gdk_wayland_window_configure (GdkWindow *window,
   GdkDisplay *display;
   GdkEvent *event;
 
+  g_return_if_fail (width > 0);
+  g_return_if_fail (height > 0);
+
   event = gdk_event_new (GDK_CONFIGURE);
   event->configure.window = g_object_ref (window);
   event->configure.send_event = FALSE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]