From 782729be1388f3b8f603b4d328bc861fd3624233 Mon Sep 17 00:00:00 2001 From: taiyu Date: Wed, 2 Sep 2015 08:51:26 -0700 Subject: properly free cmd_queue, should partially fix #165 from what i tell from its log. --- sway/handlers.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sway/handlers.c b/sway/handlers.c index b12be9f7..413c17fe 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -485,12 +485,12 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w static void handle_wlc_ready(void) { sway_log(L_DEBUG, "Compositor is ready, executing cmds in queue"); - - int i; - for (i = 0; i < config->cmd_queue->length; ++i) { - handle_command(config, config->cmd_queue->items[i]); + // Execute commands until there are none left + while (config->cmd_queue->length) { + handle_command(config, config->cmd_queue->items[0]); + free(config->cmd_queue->items[0]); + list_del(config->cmd_queue, 0); } - free_flat_list(config->cmd_queue); config->active = true; } -- cgit v1.2.3-54-g00ecf