From aef57c2e8c6a951512287635c69c24756a5bccf8 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Sat, 5 Sep 2020 00:12:17 +0100 Subject: [PATCH] FIX: Set valid config value w/new config. So, new config. Sleeping 0 * usleep causes some bad stuff to happen. Thanks thrice for getting me to find it...should use my own advice and clear my OWN config before telling users to try doing the same :) --- CREDITS | 4 ++++ src/bin/evisum_config.c | 7 +++++++ src/bin/ui/ui.c | 15 ++++++++++----- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CREDITS b/CREDITS index 621d304..30d5ed9 100644 --- a/CREDITS +++ b/CREDITS @@ -18,6 +18,10 @@ from the original by the software author. # Thanks +To our dedicated users in '#e'. + +Especially OnlyHuman, thrice, Peter2121, ApBBB... + Philippe Jean Guillaumie For his relentless commitment to translation of EFL and diff --git a/src/bin/evisum_config.c b/src/bin/evisum_config.c index 8aad4e4..c1183fd 100644 --- a/src/bin/evisum_config.c +++ b/src/bin/evisum_config.c @@ -41,6 +41,7 @@ config_load(void) { cfg = calloc(1, sizeof(Evisum_Config)); cfg->version = CONFIG_VERSION; + cfg->poll_delay = 3; f = eet_open(path, EET_FILE_MODE_WRITE); eet_write(f, "Config", cfg, sizeof(Evisum_Config), 0); eet_close(f); @@ -50,6 +51,12 @@ config_load(void) f = eet_open(path, EET_FILE_MODE_READ); if (!f) exit(127); cfg = eet_read(f, "Config", &size); + // Correct a bogus poll delay. + if (cfg->poll_delay <= 0) + { + fprintf(stderr, "WARNING: correcting a bad configuration (sorry!).\n"); + cfg->poll_delay = 3; + } eet_close(f); } diff --git a/src/bin/ui/ui.c b/src/bin/ui/ui.c index 3fce89c..92c65eb 100644 --- a/src/bin/ui/ui.c +++ b/src/bin/ui/ui.c @@ -327,8 +327,6 @@ _item_unrealized_cb(void *data, Evas_Object *obj EINA_UNUSED, static void _item_del(void *data, Evas_Object *obj EINA_UNUSED) { - Ui *ui = _ui; - Proc_Info *proc = data; proc_info_free(proc); proc = NULL; @@ -351,6 +349,7 @@ _item_column_add(Evas_Object *table, const char *text, int col) elm_table_pack(table, rect, col, 0, 1, 1); elm_table_pack(table, label, col, 0, 1, 1); + return label; } @@ -590,12 +589,13 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED, proc_info_free(prev); elm_object_item_data_set(it, proc); - elm_genlist_item_update(it); it = elm_genlist_item_next_get(it); } } + elm_genlist_realized_items_update(ui->genlist_procs); + eina_lock_release(&_lock); } @@ -1235,7 +1235,7 @@ _main_menu_create(Ui *ui, Evas_Object *btn) elm_object_content_set(o, fr); elm_ctxpopup_direction_priority_set(o, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_DOWN, - ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT); + ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT); evas_object_move(o, ox + (ow / 2), oy); evas_object_show(o); ui->main_menu = o; @@ -1400,6 +1400,7 @@ _ui_content_system_add(Ui *ui) evas_object_size_hint_weight_set(plist, EXPAND, EXPAND); evas_object_size_hint_align_set(plist, FILL, FILL); evas_object_show(plist); + elm_win_resize_object_add(ui->win, plist); frame = elm_frame_add(parent); evas_object_size_hint_weight_set(frame, EXPAND, EXPAND); @@ -1554,7 +1555,11 @@ _evisum_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { Ui *ui = data; - elm_genlist_realized_items_update(ui->genlist_procs); + if (eina_lock_take_try(&_lock)) + { + elm_genlist_realized_items_update(ui->genlist_procs); + eina_lock_release(&_lock); + } if (ui->main_menu) _main_menu_dismissed_cb(ui, NULL, NULL);