netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=059290f0751e1c61e65220072c41892ceb3dc450

commit 059290f0751e1c61e65220072c41892ceb3dc450
Author: Alastair Poole <nets...@gmail.com>
Date:   Sat Sep 12 13:40:40 2020 +0100

    process_view: make sure happens once at a time...
    
    I think this can potentially run twice on a rare occasion when
    first populating and/or sorting maybe... it shouldn't hurt
---
 src/bin/ui/ui_process_view.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/bin/ui/ui_process_view.c b/src/bin/ui/ui_process_view.c
index 21288c8..cb7b513 100644
--- a/src/bin/ui/ui_process_view.c
+++ b/src/bin/ui/ui_process_view.c
@@ -2,6 +2,8 @@
 #include "../system/process.h"
 #include "util.c"
 
+static Eina_Lock _lock;
+
 typedef struct {
    int     tid;
    char   *name;
@@ -284,6 +286,8 @@ _thread_info_set(Ui_Process *ui, Proc_Info *proc)
    Elm_Object_Item *it;
    Eina_List *l, *threads = NULL;
 
+   eina_lock_take(&_lock);
+
    if (!ui->hash_cpu_times)
      ui->hash_cpu_times = eina_hash_string_superfast_new(_hash_free_cb);
 
@@ -329,6 +333,7 @@ _thread_info_set(Ui_Process *ui, Proc_Info *proc)
         elm_genlist_item_update(it);
         it = elm_genlist_item_next_get(it);
      }
+   eina_lock_release(&_lock);
 }
 
 static void
@@ -1043,6 +1048,7 @@ _win_del_cb(void *data, Evas_Object *obj EINA_UNUSED,
    ui  = data;
    win = obj;
 
+
    if (ui->hash_cpu_times)
      eina_hash_free(ui->hash_cpu_times);
    if (ui->timer_pid)
@@ -1052,6 +1058,8 @@ _win_del_cb(void *data, Evas_Object *obj EINA_UNUSED,
    if (ui->cache)
      evisum_ui_item_cache_free(ui->cache);
 
+   eina_lock_free(&_lock);
+
    evas_object_del(win);
 
    free(ui);
@@ -1123,6 +1131,8 @@ ui_process_win_add(Evas_Object *parent_win, int pid, 
const char *cmd, int poll_d
 
    ui->cache = evisum_ui_item_cache_new(ui->genlist_threads, _item_create, 10);
 
+   eina_lock_new(&_lock);
+
    _proc_info_update(ui);
 }
 

-- 


Reply via email to