diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/comet.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/comet.c b/src/comet.c index a32382f..7adebaf 100644 --- a/src/comet.c +++ b/src/comet.c @@ -198,10 +198,10 @@ static void menu_action(Button *btn) bool closed; } *menu_ctx = CAST(btn, ButtonSimple)->data; - if (menu_ctx->closed) { - g_list_free(menu_ctx->group->children); - menu_ctx->group->children = g_list_copy(menu_ctx->toggled); - } + // NOTE: Clear the previous animation, if any + g_list_free(menu_ctx->group->children); + g_clear_pointer(&menu_ctx->group->btn.anim, animation_destroy); + menu_ctx->group->children = g_list_copy(menu_ctx->toggled); char *text = g_strdup(menu_ctx->strings[menu_ctx->closed]); button_simple_set_text(btn, text, CAST(btn, ButtonSimple)->text_color); @@ -210,10 +210,8 @@ static void menu_action(Button *btn) ? animation_group_grow_create(MILLIS(600)) : animation_group_shrink_create(MILLIS(600)); - if (button_set_animation((gpointer)menu_ctx->group, anim)) - state_request_animation(menu_ctx->state); - else - animation_destroy(anim); + g_assert(button_set_animation((gpointer)menu_ctx->group, anim)); + state_request_animation(menu_ctx->state); log_debug("%s menu", menu_ctx->closed ? "Opened" : "Closed"); menu_ctx->closed = !menu_ctx->closed; |
