diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2022-06-02 23:05:39 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2022-10-25 15:54:05 +0200 |
commit | 3b25f9a66221509c11159afd6e49ad227f575939 (patch) | |
tree | cb49f8239e6f8f6af87cf4632a6613d012fbe63e | |
parent | 7fa87abf8af6a71a02f59eb159c5650ad2a37727 (diff) | |
download | gtk+-3b25f9a66221509c11159afd6e49ad227f575939.tar.gz |
gdk/wayland: Check the GdkSurface wl_surface before using it for activation
Double check the GdkSurface has a wl_surface before using it as the activation
token source, since we cannot use NULL surfaces here.
Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1862
Backport-of: 4b41d4f78ce71b60f0d51837cd1b6a1b346d679d
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
-rw-r--r-- | gdk/wayland/gdkapplaunchcontext-wayland.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gdk/wayland/gdkapplaunchcontext-wayland.c b/gdk/wayland/gdkapplaunchcontext-wayland.c index f95b15351a..eb1d2cd88f 100644 --- a/gdk/wayland/gdkapplaunchcontext-wayland.c +++ b/gdk/wayland/gdkapplaunchcontext-wayland.c @@ -62,6 +62,7 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context { struct xdg_activation_token_v1 *token; struct wl_event_queue *event_queue; + struct wl_surface *wl_surface = NULL; GdkSeat *seat; GdkWindow *focus_window; AppLaunchData app_launch_data = { 0 }; @@ -69,7 +70,6 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context event_queue = wl_display_create_queue (display->wl_display); seat = gdk_display_get_default_seat (GDK_DISPLAY (display)); - focus_window = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (seat)); token = xdg_activation_v1_get_activation_token (display->xdg_activation); wl_proxy_set_queue ((struct wl_proxy *) token, event_queue); @@ -79,9 +79,13 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context xdg_activation_token_v1_set_serial (token, _gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL), gdk_wayland_seat_get_wl_seat (seat)); + + focus_window = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (seat)); if (focus_window) - xdg_activation_token_v1_set_surface (token, - gdk_wayland_window_get_wl_surface (focus_window)); + wl_surface = gdk_wayland_window_get_wl_surface (focus_window); + if (wl_surface) + xdg_activation_token_v1_set_surface (token, wl_surface); + xdg_activation_token_v1_commit (token); while (app_launch_data.token == NULL) |