Prevent crashes on gdk wayland implementation using offscreen windows

This commit is contained in:
Alberto Fanjul 2020-04-23 11:43:24 +02:00
parent 0576aff947
commit 1e2d72144a

View File

@ -2535,12 +2535,17 @@ calculate_moved_to_rect_result (GdkWindow *window,
gboolean *flipped_x, gboolean *flipped_x,
gboolean *flipped_y) gboolean *flipped_y)
{ {
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl;
GdkWindow *parent; GdkWindow *parent;
gint window_x, window_y; gint window_x, window_y;
gint window_width, window_height; gint window_width, window_height;
GdkRectangle best_rect; GdkRectangle best_rect;
g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window));
g_return_if_fail (GDK_IS_WINDOW_IMPL_WAYLAND (window->impl));
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
parent = translate_from_real_parent_window_geometry (window, &x, &y); parent = translate_from_real_parent_window_geometry (window, &x, &y);
*final_rect = (GdkRectangle) { *final_rect = (GdkRectangle) {
.x = x, .x = x,
@ -5328,10 +5333,16 @@ void
gdk_wayland_window_restore_shortcuts (GdkWindow *window, gdk_wayland_window_restore_shortcuts (GdkWindow *window,
GdkSeat *gdk_seat) GdkSeat *gdk_seat)
{ {
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); GdkWindowImplWayland *impl;
struct wl_seat *seat = gdk_wayland_seat_get_wl_seat (gdk_seat); struct wl_seat *seat;
struct zwp_keyboard_shortcuts_inhibitor_v1 *inhibitor; struct zwp_keyboard_shortcuts_inhibitor_v1 *inhibitor;
g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window));
g_return_if_fail (GDK_IS_WINDOW_IMPL_WAYLAND (window->impl));
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
seat = gdk_wayland_seat_get_wl_seat (gdk_seat);
inhibitor = gdk_wayland_window_get_inhibitor (impl, seat); inhibitor = gdk_wayland_window_get_inhibitor (impl, seat);
if (inhibitor == NULL) if (inhibitor == NULL)
return; /* Not inhibitted */ return; /* Not inhibitted */