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 <marius.vlad@collabora.com>
(cherry picked from commit 6617deebec)
This commit is contained in:
Marius Vlad 2023-02-17 00:21:59 +02:00
parent 0849a9b3c8
commit 7047926834
1 changed files with 13 additions and 0 deletions

View File

@ -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) {