[PATCH wlr-randr] Destroy head and mode objects before disconnect
Export this patch
The latest version of libwayland now prints warnings if we don't destroy
these.
warning: queue 0x56103a63e390 destroyed while proxies still attached:
zwlr_output_mode_v1@4278190123 still attached
zwlr_output_mode_v1@4278190122 still attached
...
---
main.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/main.c b/main.c
index 82c8466..33a1656 100644
--- a/main.c
+++ b/main.c
@@ -754,7 +754,14 @@ int main(int argc, char *argv[]) {
// This space intentionally left blank
}
- // TODO: destroy heads
+ struct randr_head *head, *tmp_head;
+ wl_list_for_each_safe(head, tmp_head, &state.heads, link) {
+ struct randr_mode *mode, *tmp_mode;
+ wl_list_for_each_safe(mode, tmp_mode, &head->modes, link) {
+ zwlr_output_mode_v1_destroy(mode->wlr_mode);
+ }
+ zwlr_output_head_v1_destroy(head->wlr_head);
+ }
zwlr_output_manager_v1_destroy(state.output_manager);
wl_registry_destroy(registry);
wl_display_disconnect(display);
--
2.39.1
Pushed with a few changes:
- s/spaces/tabs/ for indentation
- Free the strings and structs as well
Thanks!