summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2022-12-18 09:45:00 +0100
committerJonas Ådahl <jadahl@gmail.com>2022-12-18 09:47:29 +0100
commit439856e7aae82a9b237cae4c548e1352456db8bf (patch)
tree309f1e79996755695536afeb0fdb553470c7b476
parenta16df485db087453a5b0f4b1d533eba4751434d4 (diff)
downloadmutter-439856e7aae82a9b237cae4c548e1352456db8bf.tar.gz
wayland/gtk-shell: Dereference surface after NULL check
Spotted by coverity. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2772>
-rw-r--r--src/wayland/meta-wayland-gtk-shell.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/wayland/meta-wayland-gtk-shell.c b/src/wayland/meta-wayland-gtk-shell.c
index c9196a645..1cc6093e7 100644
--- a/src/wayland/meta-wayland-gtk-shell.c
+++ b/src/wayland/meta-wayland-gtk-shell.c
@@ -172,9 +172,8 @@ gtk_surface_request_focus (struct wl_client *client,
{
MetaWaylandGtkSurface *gtk_surface = wl_resource_get_user_data (resource);
MetaWaylandSurface *surface = gtk_surface->surface;
- MetaContext *context =
- meta_wayland_compositor_get_context (surface->compositor);
- MetaDisplay *display = meta_context_get_display (context);
+ MetaContext *context;
+ MetaDisplay *display;
MetaStartupSequence *sequence = NULL;
MetaWindow *window;
@@ -185,6 +184,9 @@ gtk_surface_request_focus (struct wl_client *client,
if (!window)
return;
+ context = meta_wayland_compositor_get_context (surface->compositor);
+ display = meta_context_get_display (context);
+
if (startup_id)
sequence = meta_startup_notification_lookup_sequence (display->startup_notification,
startup_id);