diff --git a/src/bin/empc.c b/src/bin/empc.c index 7b50512..873772a 100644 --- a/src/bin/empc.c +++ b/src/bin/empc.c @@ -125,6 +125,14 @@ bg_next_get(void) return num % 2; } +static void +queue_list_clear(void) +{ + eina_hash_free_buckets(empd_current_queue_headers); + elm_genlist_clear(queue_list); + queue_list_scroll_item = NULL; +} + static void item_box_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -1793,8 +1801,7 @@ onconnected(Eina_Bool diff, const char *host, unsigned int port) config_call = empd_empdd_config_call(empd_proxy, config_cb, NULL); empd_empdd_status_call(empd_proxy); if (!diff) return; - eina_hash_free_buckets(empd_current_queue_headers); - elm_genlist_clear(queue_list); + queue_list_clear(); if (filesystems) { while (filesystems->next) @@ -2687,8 +2694,7 @@ queue_list_handler(Eina_Value *value, Eina_Bool cached) Elm_Object_Item *it; const Eina_List *l, *its = elm_genlist_selected_items_get(queue_list); elm_scroller_region_get(queue_list, &x, &y, &w, &h); - eina_hash_free_buckets(empd_current_queue_headers); - elm_genlist_clear(queue_list); + queue_list_clear(); if (its) { EINA_LIST_FOREACH(its, l, it)