From 6b47ad6aac20d025d8adbd29c4cc887b2aa67bf1 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Wed, 20 Jan 2021 12:49:11 +0000 Subject: [PATCH] view: leak fix --- src/bin/ui/ui_process_view.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/bin/ui/ui_process_view.c b/src/bin/ui/ui_process_view.c index 5d078f2..c6d543a 100644 --- a/src/bin/ui/ui_process_view.c +++ b/src/bin/ui/ui_process_view.c @@ -439,9 +439,6 @@ _thread_info_set(Ui_Data *pd, Proc_Info *proc) Elm_Object_Item *it; Eina_List *l, *threads = NULL; - if (!pd->hash_cpu_times) - pd->hash_cpu_times = eina_hash_string_superfast_new(_hash_free_cb); - _genlist_ensure_n_items(pd->genlist_threads, eina_list_count(proc->threads)); EINA_LIST_FOREACH(proc->threads, l, p) @@ -748,6 +745,9 @@ _threads_cpu_usage(Ui_Data *pd, Proc_Info *proc) Eina_List *l; Proc_Info *p; + if (!pd->hash_cpu_times) + pd->hash_cpu_times = eina_hash_string_superfast_new(_hash_free_cb); + EINA_LIST_FOREACH(proc->threads, l, p) { long *cpu_time, *cpu_time_prev; @@ -787,6 +787,8 @@ _proc_info_feedback_cb(void *data, Ecore_Thread *thread, void *msg) return; } + if (ecore_thread_check(thread)) return; + _threads_cpu_usage(pd, proc); if (pd->poll_count != 0 && (pd->poll_count % 10)) @@ -1526,15 +1528,14 @@ _win_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, pd = data; win = obj; - if (pd->hash_cpu_times) - eina_hash_free(pd->hash_cpu_times); - if (pd->thread) { ecore_thread_cancel(pd->thread); ecore_thread_wait(pd->thread, 0.5); } + if (pd->hash_cpu_times) + eina_hash_free(pd->hash_cpu_times); if (pd->selected_cmd) free(pd->selected_cmd); if (pd->cache)