From 10403a85ec03aff7deaa2bc9efb848660fea1100 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Thu, 23 Jun 2022 15:32:46 +0200 Subject: [PATCH] libweston: disable a pending idle_repaint_source when the output is removed Currently the idle_repaint_source is removed when the output is destroyed. This covers the most common case: When a monitor is unplugged then the corresponding DRM output is destroyed and not just disabled. However, outputs can be explicitly disabled by the shell. In this case the output is not removed and idle_repaint() may be called for a removed output. Remove the idle_repaint_source in weston_compositor_remove_output() to fix this. And reset the variable to ensure that the source can be created again. Removing the source in weston_output_release() is now no longer necessary since it calls weston_compositor_remove_output(). Signed-off-by: Michael Olbrich --- libweston/compositor.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index 6282901a..64e24741 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -6667,6 +6667,11 @@ weston_compositor_remove_output(struct weston_output *output) assert(output->destroying); assert(output->enabled); + if (output->idle_repaint_source) { + wl_event_source_remove(output->idle_repaint_source); + output->idle_repaint_source = NULL; + } + wl_list_for_each_safe(pnode, pntmp, &output->paint_node_list, output_link) { weston_paint_node_destroy(pnode); @@ -7315,9 +7320,6 @@ weston_output_release(struct weston_output *output) weston_signal_emit_mutable(&output->user_destroy_signal, output); - if (output->idle_repaint_source) - wl_event_source_remove(output->idle_repaint_source); - if (output->enabled) weston_compositor_remove_output(output);