[gtk+] -wayland: Safeguard against NULL gtk_surface1



commit 04456404be970595daefe9377d0c59571ce44d7f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Oct 4 18:25:31 2017 -0300

    -wayland: Safeguard against NULL gtk_surface1
    
    There is no guarantee that the gtk_surface won't be NULL,
    and Wayland API does not safeguard against NULL, so we have
    to do that ourselves here.
    
    We were also mistakenly cheking for the surface version off
    by one, fix that too by checking if the surface version is
    equal or greater.

 gdk/wayland/gdkwindow-wayland.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 50d6bd3..64f2b20 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -3644,8 +3644,12 @@ static gboolean
 gdk_wayland_window_supports_edge_constraints (GdkWindow *window)
 {
   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+  struct gtk_surface1 *gtk_surface = impl->display_server.gtk_surface;
 
-  return gtk_surface1_get_version (impl->display_server.gtk_surface) > 
GTK_SURFACE1_CONFIGURE_EDGES_SINCE_VERSION;
+  if (!gtk_surface)
+    return FALSE;
+
+  return gtk_surface1_get_version (gtk_surface) >= GTK_SURFACE1_CONFIGURE_EDGES_SINCE_VERSION;
 }
 
 static void


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