From 70479268340f50cebe3f1dec45d51c1ec5b140e7 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Fri, 17 Feb 2023 00:21:59 +0200 Subject: [PATCH] pipewire-plugin: Check virtual outputs/remoting instance Similarly to remoting plug-in in commit "Check virtual outputs/remoting instance" this avoids touching the pipewire instance, and with it, the pipewire output. Includes a note to point up what should be done about by checking out https://gitlab.freedesktop.org/wayland/weston/-/issues/591. Signed-off-by: Marius Vlad (cherry picked from commit 6617deebec5586c4d8c61097b7e51dd53c4e4624) --- pipewire/pipewire-plugin.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pipewire/pipewire-plugin.c b/pipewire/pipewire-plugin.c index b8dad03e..748ba492 100644 --- a/pipewire/pipewire-plugin.c +++ b/pipewire/pipewire-plugin.c @@ -149,6 +149,16 @@ lookup_pipewire_output(struct weston_output *base_output) struct weston_pipewire *pipewire = weston_pipewire_get(c); struct pipewire_output *output; + /* XXX: This could happen on the compositor shutdown path with our + * destroy listener being removed, and pipewire_output_destroy() being + * called as a virtual destructor. + * + * See https://gitlab.freedesktop.org/wayland/weston/-/issues/591 for + * an alternative to the shutdown sequence. + */ + if (!pipewire) + return NULL; + wl_list_for_each(output, &pipewire->output_list, link) { if (output->output == base_output) return output; @@ -310,6 +320,9 @@ pipewire_output_destroy(struct weston_output *base_output) struct pipewire_output *output = lookup_pipewire_output(base_output); struct weston_mode *mode, *next; + if (!output) + return; + weston_head_release(output->head); wl_list_for_each_safe(mode, next, &base_output->mode_list, link) {