This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository evisum.
View the commit online.
commit 3baa65c0f2fb724c1dd5f4dbf8bea225e2d4a5ea
Author: Alastair Poole <[email protected]>
AuthorDate: Tue Apr 28 04:21:21 2026 +0100
cpu: fix init
---
src/bin/engine/evisum_engine.c | 6 +++++-
src/bin/ui/evisum_ui_cpu.c | 5 +++++
src/bin/ui/visuals/cpu_bars.c | 8 +++++---
src/bin/ui/visuals/cpu_basic.c | 8 +++++---
src/bin/ui/visuals/cpu_default.c | 12 ++++++++++--
5 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/src/bin/engine/evisum_engine.c b/src/bin/engine/evisum_engine.c
index 33b7326..eaa8096 100644
--- a/src/bin/engine/evisum_engine.c
+++ b/src/bin/engine/evisum_engine.c
@@ -878,9 +878,13 @@ system_cpu_online_count_get(void)
const Snapshot *snap;
int n;
- if (!_engine_snapshot_acquire(&snap)) return 1;
+ if (!_engine_snapshot_acquire(&snap)) {
+ n = (int) sysconf(_SC_NPROCESSORS_ONLN);
+ return n > 0 ? n : 1;
+ }
n = eina_list_count(snap->cores);
_engine_snapshot_release();
+ if (n <= 0) n = (int) sysconf(_SC_NPROCESSORS_ONLN);
return n > 0 ? n : 1;
}
diff --git a/src/bin/ui/evisum_ui_cpu.c b/src/bin/ui/evisum_ui_cpu.c
index 2a07508..399df47 100644
--- a/src/bin/ui/evisum_ui_cpu.c
+++ b/src/bin/ui/evisum_ui_cpu.c
@@ -160,6 +160,11 @@ evisum_ui_cpu_win_add(Evisum_Ui *ui) {
exit(1);
}
pd = vis->func(box);
+ if (!pd) {
+ evas_object_del(win);
+ ui->cpu.win = NULL;
+ return;
+ }
pd->win = win;
pd->ui = ui;
diff --git a/src/bin/ui/visuals/cpu_bars.c b/src/bin/ui/visuals/cpu_bars.c
index dfec89e..dff259e 100644
--- a/src/bin/ui/visuals/cpu_bars.c
+++ b/src/bin/ui/visuals/cpu_bars.c
@@ -64,11 +64,13 @@ _core_times_main_cb(void *data, Ecore_Thread *thread) {
if (!evisum_background_update_wait(&seq)) continue;
Cpu_Core **cores = system_cpu_state_get(&ncpu);
if (!cores || ncpu <= 0) continue;
- Core *cores_out = calloc(ncpu, sizeof(Core));
+ Core *cores_out = calloc(ext->cpu_count, sizeof(Core));
if (cores_out) {
- for (int n = 0; n < ncpu; n++) {
+ for (int n = 0; n < ext->cpu_count; n++) {
int id = ext->cpu_order[n];
+ if ((id < 0) || (id >= ncpu)) id = n;
+ if (id >= ncpu) continue;
Core *core = &(cores_out[n]);
core->id = id;
core->percent = cores[id]->percent;
@@ -150,7 +152,6 @@ evisum_ui_cpu_visual_bars(Evas_Object *parent_bx) {
ext->cpu_count = system_cpu_count_get();
ext->cpu_order = malloc((ext->cpu_count) * sizeof(int));
ext->cpu_smooth = malloc((ext->cpu_count) * sizeof(int));
- for (i = 0; i < ext->cpu_count; i++) ext->cpu_order[i] = i;
if (!ext->cpu_order || !ext->cpu_smooth) {
free(ext->cpu_order);
free(ext->cpu_smooth);
@@ -158,6 +159,7 @@ evisum_ui_cpu_visual_bars(Evas_Object *parent_bx) {
free(pd);
return NULL;
}
+ for (i = 0; i < ext->cpu_count; i++) ext->cpu_order[i] = i;
for (i = 0; i < ext->cpu_count; i++) ext->cpu_smooth[i] = -1;
system_cpu_topology_get(ext->cpu_order, ext->cpu_count);
diff --git a/src/bin/ui/visuals/cpu_basic.c b/src/bin/ui/visuals/cpu_basic.c
index ee8d4e3..95dc66b 100644
--- a/src/bin/ui/visuals/cpu_basic.c
+++ b/src/bin/ui/visuals/cpu_basic.c
@@ -35,11 +35,13 @@ _core_times_main_cb(void *data, Ecore_Thread *thread) {
if (!evisum_background_update_wait(&seq)) continue;
Cpu_Core **cores = system_cpu_state_get(&ncpu);
if (!cores || ncpu <= 0) continue;
- Core *cores_out = calloc(ncpu, sizeof(Core));
+ Core *cores_out = calloc(ext->cpu_count, sizeof(Core));
if (cores_out) {
- for (int n = 0; n < ncpu; n++) {
+ for (int n = 0; n < ext->cpu_count; n++) {
int id = ext->cpu_order[n];
+ if ((id < 0) || (id >= ncpu)) id = n;
+ if (id >= ncpu) continue;
Core *core = &(cores_out[n]);
core->id = id;
core->percent = cores[id]->percent;
@@ -168,7 +170,6 @@ evisum_ui_cpu_visual_basic(Evas_Object *parent_bx) {
ext->cpu_count = system_cpu_count_get();
ext->cpu_order = malloc((ext->cpu_count) * sizeof(int));
ext->cpu_smooth = malloc((ext->cpu_count) * sizeof(int));
- for (int i = 0; i < ext->cpu_count; i++) ext->cpu_order[i] = i;
if (!ext->cpu_order || !ext->cpu_smooth) {
free(ext->cpu_order);
free(ext->cpu_smooth);
@@ -176,6 +177,7 @@ evisum_ui_cpu_visual_basic(Evas_Object *parent_bx) {
free(pd);
return NULL;
}
+ for (int i = 0; i < ext->cpu_count; i++) ext->cpu_order[i] = i;
for (int i = 0; i < ext->cpu_count; i++) ext->cpu_smooth[i] = -1;
system_cpu_topology_get(ext->cpu_order, ext->cpu_count);
diff --git a/src/bin/ui/visuals/cpu_default.c b/src/bin/ui/visuals/cpu_default.c
index fe204a2..640b084 100644
--- a/src/bin/ui/visuals/cpu_default.c
+++ b/src/bin/ui/visuals/cpu_default.c
@@ -62,11 +62,13 @@ _core_times_main_cb(void *data, Ecore_Thread *thread) {
if (!evisum_background_update_wait(&seq)) continue;
Cpu_Core **cores = system_cpu_state_get(&ncpu);
if (!cores || ncpu <= 0) continue;
- Core *cores_out = calloc(ncpu, sizeof(Core));
+ Core *cores_out = calloc(ext->cpu_count, sizeof(Core));
if (cores_out) {
- for (int n = 0; n < ncpu; n++) {
+ for (int n = 0; n < ext->cpu_count; n++) {
int id = ext->cpu_order[n];
+ if ((id < 0) || (id >= ncpu)) id = n;
+ if (id >= ncpu) continue;
Core *core = &(cores_out[n]);
core->id = id;
core->percent = cores[id]->percent;
@@ -317,6 +319,11 @@ evisum_ui_cpu_visual_default(Evas_Object *parent_box) {
if ((system_cpu_n_temperature_get(0)) != -1) ext->cpu_temp = 1;
ext->cpu_order = cpu_order = malloc((ext->cpu_count) * sizeof(int));
+ if (!cpu_order) {
+ free(ext);
+ free(pd);
+ return NULL;
+ }
for (i = 0; i < ext->cpu_count; i++) cpu_order[i] = i;
system_cpu_topology_get(cpu_order, ext->cpu_count);
@@ -415,6 +422,7 @@ evisum_ui_cpu_visual_default(Evas_Object *parent_box) {
elm_table_pack(tbl, tbl2, 4, i, 1, 1);
Explainer *exp = malloc(sizeof(Explainer));
+ if (!exp) continue;
exp->rec = rec;
exp->lb = lb;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.