wayland: check activation supported before activating

It's possible for token to be set when the compositor doesn't support
activation, and this caused a segfault.  For example, this can happen
when overriding WAYLAND_DISPLAY to point to a compositor that doesn't
support activation, in a terminal running under one that does, and so
has set XDG_ACTIVATION_TOKEN.
This commit is contained in:
Alyssa Ross 2023-09-21 06:59:48 +00:00
parent a4843ef418
commit 9257273d84
No known key found for this signature in database
GPG key ID: F9DBED4859B271C0

View file

@ -1701,7 +1701,7 @@ wayl_win_init(struct terminal *term, const char *token)
wl_surface_commit(win->surface.surf);
/* Complete XDG startup notification */
if (token)
if (token && wayl->xdg_activation)
xdg_activation_v1_activate(wayl->xdg_activation, token, win->surface.surf);
if (!wayl_win_subsurface_new(win, &win->overlay, false)) {