mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-30 00:15:58 +01:00
Fix memory leak in wlr_cursor
This commit is contained in:
parent
2c63aa2056
commit
7dc716a2bb
2 changed files with 13 additions and 12 deletions
|
@ -212,6 +212,11 @@ int main(int argc, char *argv[]) {
|
||||||
wl_display_run(compositor.display);
|
wl_display_run(compositor.display);
|
||||||
compositor_fini(&compositor);
|
compositor_fini(&compositor);
|
||||||
|
|
||||||
|
struct sample_cursor *cursor;
|
||||||
|
wl_list_for_each(cursor, &state.cursors, link) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
wlr_xcursor_theme_destroy(theme);
|
wlr_xcursor_theme_destroy(theme);
|
||||||
example_config_destroy(state.config);
|
example_config_destroy(state.config);
|
||||||
wlr_output_layout_destroy(state.layout);
|
wlr_output_layout_destroy(state.layout);
|
||||||
|
|
|
@ -98,7 +98,7 @@ struct wlr_cursor *wlr_cursor_create() {
|
||||||
return cur;
|
return cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_cursor_remove(
|
static void output_cursor_destroy(
|
||||||
struct wlr_cursor_output_cursor *output_cursor) {
|
struct wlr_cursor_output_cursor *output_cursor) {
|
||||||
wl_list_remove(&output_cursor->layout_output_destroy.link);
|
wl_list_remove(&output_cursor->layout_output_destroy.link);
|
||||||
wl_list_remove(&output_cursor->link);
|
wl_list_remove(&output_cursor->link);
|
||||||
|
@ -111,15 +111,10 @@ static void wlr_cursor_detach_output_layout(struct wlr_cursor *cur) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_output_layout_output *l_output;
|
struct wlr_cursor_output_cursor *output_cursor, *tmp;
|
||||||
wl_list_for_each(l_output, &cur->state->layout->outputs, link) {
|
wl_list_for_each_safe(output_cursor, tmp, &cur->state->output_cursors,
|
||||||
struct wlr_cursor_output_cursor *output_cursor, *tmp;
|
link) {
|
||||||
wl_list_for_each_safe(output_cursor, tmp, &cur->state->output_cursors,
|
output_cursor_destroy(output_cursor);
|
||||||
link) {
|
|
||||||
if (output_cursor->output_cursor->output == l_output->output) {
|
|
||||||
output_cursor_remove(output_cursor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_remove(&cur->state->layout_destroy.link);
|
wl_list_remove(&cur->state->layout_destroy.link);
|
||||||
|
@ -161,6 +156,7 @@ void wlr_cursor_destroy(struct wlr_cursor *cur) {
|
||||||
wlr_cursor_device_destroy(device);
|
wlr_cursor_device_destroy(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(cur->state);
|
||||||
free(cur);
|
free(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +514,7 @@ static void handle_layout_output_destroy(struct wl_listener *listener,
|
||||||
struct wlr_cursor_output_cursor *output_cursor =
|
struct wlr_cursor_output_cursor *output_cursor =
|
||||||
wl_container_of(listener, output_cursor, layout_output_destroy);
|
wl_container_of(listener, output_cursor, layout_output_destroy);
|
||||||
//struct wlr_output_layout_output *l_output = data;
|
//struct wlr_output_layout_output *l_output = data;
|
||||||
output_cursor_remove(output_cursor);
|
output_cursor_destroy(output_cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void layout_add(struct wlr_cursor_state *state,
|
static void layout_add(struct wlr_cursor_state *state,
|
||||||
|
@ -542,7 +538,7 @@ static void layout_add(struct wlr_cursor_state *state,
|
||||||
wl_signal_add(&l_output->events.destroy,
|
wl_signal_add(&l_output->events.destroy,
|
||||||
&output_cursor->layout_output_destroy);
|
&output_cursor->layout_output_destroy);
|
||||||
|
|
||||||
wl_list_insert(&state->cursor->state->output_cursors, &output_cursor->link);
|
wl_list_insert(&state->output_cursors, &output_cursor->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_layout_add(struct wl_listener *listener, void *data) {
|
static void handle_layout_add(struct wl_listener *listener, void *data) {
|
||||||
|
|
Loading…
Reference in a new issue