remoting-plugin: Check virtual outputs/remoting instance

With commit aab722bb, "backend-drm: prepare virtual output API for
heterogeneous outputs", we now call the virtual destroy function,
but when shutting the compositor we no longer have a remoting instance
available.

When searching out for a remoting output verify if the remoting instance is
still available before attempting to search for a remoting output.

Addresses the following crash at shutdown:

0x00007fd430a1d347 in lookup_remoted_output (output=0x557163d5dad0) at ../remoting/remoting-plugin.c:515
0x00007fd430a1d746 in remoting_output_destroy (output=0x557163d5dad0) at ../remoting/remoting-plugin.c:635
0x00007fd439e11ab9 in drm_virtual_output_destroy (base=0x557163d5dad0) at ../libweston/backend-drm/drm-virtual.c:265
0x00007fd43a8635d0 in weston_compositor_shutdown (ec=0x557163239530) at ../libweston/compositor.c:8271
0x00007fd439e029d4 in drm_destroy (backend=0x557163240ae0) at ../libweston/backend-drm/drm.c:2713
0x00007fd43a863e07 in weston_compositor_destroy (compositor=0x557163239530) at ../libweston/compositor.c:8626

Includes a note to point up what should be done about by
checking out https://gitlab.freedesktop.org/wayland/weston/-/issues/591.

Fixes aab722bb "backend-drm: prepare virtual output API for
heterogeneous outputs"

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
(cherry picked from commit ca52c79c51088ca4c724b34e54c3bb97a9a51c67)
dev
Marius Vlad 2 years ago
parent 0ba5b694d3
commit 17f5a44f3b
  1. 13
      remoting/remoting-plugin.c

@ -512,6 +512,16 @@ lookup_remoted_output(struct weston_output *output)
struct weston_remoting *remoting = weston_remoting_get(c); struct weston_remoting *remoting = weston_remoting_get(c);
struct remoted_output *remoted_output; struct remoted_output *remoted_output;
/* XXX: This could happen on the compositor shutdown path with our
* destroy listener being removed, and remoting_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 (!remoting)
return NULL;
wl_list_for_each(remoted_output, &remoting->output_list, link) { wl_list_for_each(remoted_output, &remoting->output_list, link) {
if (remoted_output->output == output) if (remoted_output->output == output)
return remoted_output; return remoted_output;
@ -636,6 +646,9 @@ remoting_output_destroy(struct weston_output *output)
struct remoted_output *remoted_output = lookup_remoted_output(output); struct remoted_output *remoted_output = lookup_remoted_output(output);
struct weston_mode *mode, *next; struct weston_mode *mode, *next;
if (!remoted_output)
return;
weston_head_release(remoted_output->head); weston_head_release(remoted_output->head);
wl_list_for_each_safe(mode, next, &output->mode_list, link) { wl_list_for_each_safe(mode, next, &output->mode_list, link) {

Loading…
Cancel
Save