From 04456404be970595daefe9377d0c59571ce44d7f Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Wed, 4 Oct 2017 18:25:31 -0300 Subject: [PATCH] -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 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index 50d6bd36b5..64f2b201a5 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