From 083d1eed1f61f8cc7397031f1ab987022ba6868e Mon Sep 17 00:00:00 2001 From: taiyu Date: Sat, 15 Aug 2015 21:21:20 -0700 Subject: fixed 2 small memory leaks & adds format attribute to log. --- sway/container.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index 98941b2c..d1c8a7de 100644 --- a/sway/container.c +++ b/sway/container.c @@ -31,6 +31,9 @@ static void free_swayc(swayc_t *c) { } remove_child(c->parent, c); } + if (c->name) { + free(c->name); + } free(c); } -- cgit v1.2.3 From eefc76b39e61ce04fa8ac0e732a22c10d9c98e1f Mon Sep 17 00:00:00 2001 From: taiyu Date: Sun, 16 Aug 2015 00:46:58 -0700 Subject: set userdata for handler to swayc_t container --- sway/container.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sway/container.c') diff --git a/sway/container.c b/sway/container.c index d1c8a7de..ff9c983a 100644 --- a/sway/container.c +++ b/sway/container.c @@ -54,8 +54,10 @@ swayc_t *new_output(wlc_handle handle) { output->height = size->h; output->handle = handle; - add_child(&root_container, output); + //link this to handler + wlc_handle_set_user_data(handle, output); + add_child(&root_container, output); //TODO something with this int total_width = 0; container_map(&root_container, add_output_widths, &total_width); @@ -138,6 +140,8 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { view->name = strdup(title); view->visible = true; + //Link view to handle + wlc_handle_set_user_data(handle, view); //Case of focused workspace, just create as child of it if (sibling->type == C_WORKSPACE) { add_child(sibling, view); -- cgit v1.2.3