summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2023-02-01 22:25:06 +0200
committerMarius Vlad <marius.vlad@collabora.com>2023-05-16 10:44:25 +0300
commit17f5a44f3b992fc6f38fb055f09aaedadbecf893 (patch)
treea4550d661065100304a2c73d2fdbe3fa905efbc9
parent0ba5b694d38a343191de3a65c59e62b281d83125 (diff)
downloadweston-17f5a44f3b992fc6f38fb055f09aaedadbecf893.tar.gz
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)
-rw-r--r--remoting/remoting-plugin.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/remoting/remoting-plugin.c b/remoting/remoting-plugin.c
index aabcd597..4d4dea7e 100644
--- a/remoting/remoting-plugin.c
+++ b/remoting/remoting-plugin.c
@@ -512,6 +512,16 @@ lookup_remoted_output(struct weston_output *output)
struct weston_remoting *remoting = weston_remoting_get(c);
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) {
if (remoted_output->output == 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 weston_mode *mode, *next;
+ if (!remoted_output)
+ return;
+
weston_head_release(remoted_output->head);
wl_list_for_each_safe(mode, next, &output->mode_list, link) {