mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-19 06:59:48 -05:00
backend: fix use-after-free when destroying backends
The backend destroy signal is emitted before the output_remove signal is. When the destroy signal is emitted listeners remove their output_remove listener, so the output_remove signal is never received and listeners have an invalid output pointer. The correct way to solve this would be to remove the output_remove signal completely and use the wlr_output.events.destroy signal instead. This isn't yet possible because wl_signal_emit is unsafe and listeners cannot be removed in listeners.
This commit is contained in:
parent
704130cc11
commit
babdd6ccf7
10 changed files with 27 additions and 13 deletions
|
|
@ -286,6 +286,7 @@ void wlr_output_destroy(struct wlr_output *output) {
|
|||
wlr_output_destroy_global(output);
|
||||
wlr_output_set_fullscreen_surface(output, NULL);
|
||||
|
||||
wl_signal_emit(&output->backend->events.output_remove, output);
|
||||
wl_signal_emit(&output->events.destroy, output);
|
||||
|
||||
struct wlr_output_mode *mode, *tmp_mode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue