compositor: prevent weston_surface references a destroyed output

weston_surface retains a pointer to its associated output, but if the
output is destroyed, the pointer becomes invalid. In set_fullscreen(),
weston_shell_utils_get_focused_output may return this stale output via
weston_keyboard, leading to a use-after-free crash.

This change ensures the output reference is cleared when the output is
destroyed, preventing potential crashes.

Signed-off-by: zhou liang <liang.zhou@gehealthcare.com>
This commit is contained in:
zhou liang 2025-06-07 03:28:10 +00:00 committed by Marius Vlad
parent 0286b37d76
commit fc3e3cf653

View file

@ -1483,6 +1483,7 @@ notify_view_output_destroy(struct wl_listener *listener, void *data)
struct weston_view, output_destroy_listener);
view->output = NULL;
view->surface->output = NULL;
view->output_destroy_listener.notify = NULL;
}