-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.
This commit is contained in:
Georges Basile Stavracas Neto 2017-10-04 18:25:31 -03:00
parent f63519dc01
commit 04456404be

View File

@ -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