Commit 61f846c784e5c7e9eb68da669fe1cbebcebc9a05 Parent: 96e20bbc3c799275a645bf3b3f6bae3501f8f0b8 Author: mcol <mcol@posteo.net> Date: 2021-01-24 22:17:18 +0000 Committer: mcol <mcol@posteo.net> Committed: 2021-01-24 22:31:13 +0000 free everything when exiting
src/types.h Modified
@@ -97,6 +97,12 @@ double x, y; }; +struct output { + struct wl_list link; + struct wlr_output *wlr_output; + struct wl_listener frame_listener; +}; + struct keyboard { struct wl_list link; struct wlr_input_device *device;
src/output.c Modified
@@ -6,13 +6,6 @@ #include "types.h" -struct output { - struct wl_list link; - struct wlr_output *wlr_output; - struct wl_listener frame_listener; -}; - - struct render_data { struct wlr_output *output; struct wlr_renderer *renderer;
src/main.c Modified
@@ -44,6 +44,55 @@ ; +static void free_stuff() { + struct binding *kb, *tkb; + wl_list_for_each_safe(kb, tkb, &wimp.mouse_bindings, link) { + wl_list_remove(&kb->link); + if (kb->data) { + free(kb->data); + } + free(kb); + }; + wl_list_for_each_safe(kb, tkb, &wimp.key_bindings, link) { + wl_list_remove(&kb->link); + if (kb->data) { + free(kb->data); + } + free(kb); + }; + + struct desk *desk, *tdesk; + struct view *view, *tview; + wl_list_for_each_safe(desk, tdesk, &wimp.desks, link) { + wl_list_for_each_safe(view, tview, &desk->views, link) { + wl_list_remove(&view->link); + free(view); + }; + wl_list_remove(&desk->link); + free(desk->wallpaper); + free(desk); + }; + + struct output *output, *toutput; + wl_list_for_each_safe(output, toutput, &wimp.outputs, link) { + wl_list_remove(&output->link); + free(output); + }; + + struct keyboard *keyboard, *tkeyboard; + wl_list_for_each_safe(keyboard, tkeyboard, &wimp.keyboards, link) { + wl_list_remove(&keyboard->link); + free(keyboard); + }; + + struct mark *mark, *tmark; + wl_list_for_each_safe(mark, tmark, &wimp.marks, link) { + wl_list_remove(&mark->link); + free(mark); + }; +} + + int main(int argc, char *argv[]) { int opt; @@ -117,6 +166,7 @@ // stop wl_display_destroy_clients(wimp.display); + free_stuff(); wlr_backend_destroy(wimp.backend); wl_display_destroy(wimp.display); return EXIT_SUCCESS;