unify genlist clear functions to avoid future bugs

This commit is contained in:
Mike Blumenkrantz 2014-12-26 02:08:04 -05:00
parent 6e8e8af54e
commit d1e574b435
1 changed files with 10 additions and 4 deletions

View File

@ -125,6 +125,14 @@ bg_next_get(void)
return num % 2; 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 static void
item_box_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 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); config_call = empd_empdd_config_call(empd_proxy, config_cb, NULL);
empd_empdd_status_call(empd_proxy); empd_empdd_status_call(empd_proxy);
if (!diff) return; if (!diff) return;
eina_hash_free_buckets(empd_current_queue_headers); queue_list_clear();
elm_genlist_clear(queue_list);
if (filesystems) if (filesystems)
{ {
while (filesystems->next) while (filesystems->next)
@ -2687,8 +2694,7 @@ queue_list_handler(Eina_Value *value, Eina_Bool cached)
Elm_Object_Item *it; Elm_Object_Item *it;
const Eina_List *l, *its = elm_genlist_selected_items_get(queue_list); const Eina_List *l, *its = elm_genlist_selected_items_get(queue_list);
elm_scroller_region_get(queue_list, &x, &y, &w, &h); elm_scroller_region_get(queue_list, &x, &y, &w, &h);
eina_hash_free_buckets(empd_current_queue_headers); queue_list_clear();
elm_genlist_clear(queue_list);
if (its) if (its)
{ {
EINA_LIST_FOREACH(its, l, it) EINA_LIST_FOREACH(its, l, it)