1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(sysmon): fix heap memory overflow (#7576)

This commit is contained in:
Chishin 2025-01-10 10:27:59 +08:00 committed by GitHub
parent 51a3d93852
commit 4e52b15508
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,6 +105,7 @@ void lv_sysmon_show_performance(lv_display_t * disp)
return; return;
} }
if(disp->perf_label == NULL) {
disp->perf_label = lv_sysmon_create(disp); disp->perf_label = lv_sysmon_create(disp);
if(disp->perf_label == NULL) { if(disp->perf_label == NULL) {
LV_LOG_WARN("Couldn't create sysmon"); LV_LOG_WARN("Couldn't create sysmon");
@ -116,6 +117,7 @@ void lv_sysmon_show_performance(lv_display_t * disp)
lv_subject_add_observer_obj(&disp->perf_sysmon_backend.subject, perf_observer_cb, disp->perf_label, NULL); lv_subject_add_observer_obj(&disp->perf_sysmon_backend.subject, perf_observer_cb, disp->perf_label, NULL);
disp->perf_sysmon_backend.timer = lv_timer_create(perf_update_timer_cb, LV_SYSMON_REFR_PERIOD_DEF, disp); disp->perf_sysmon_backend.timer = lv_timer_create(perf_update_timer_cb, LV_SYSMON_REFR_PERIOD_DEF, disp);
lv_display_add_event_cb(disp, perf_monitor_disp_event_cb, LV_EVENT_ALL, NULL); lv_display_add_event_cb(disp, perf_monitor_disp_event_cb, LV_EVENT_ALL, NULL);
}
#if LV_USE_PERF_MONITOR_LOG_MODE #if LV_USE_PERF_MONITOR_LOG_MODE
lv_obj_add_flag(disp->perf_label, LV_OBJ_FLAG_HIDDEN); lv_obj_add_flag(disp->perf_label, LV_OBJ_FLAG_HIDDEN);
@ -147,6 +149,7 @@ void lv_sysmon_show_memory(lv_display_t * disp)
return; return;
} }
if(disp->mem_label == NULL) {
disp->mem_label = lv_sysmon_create(disp); disp->mem_label = lv_sysmon_create(disp);
if(disp->mem_label == NULL) { if(disp->mem_label == NULL) {
LV_LOG_WARN("Couldn't create sysmon"); LV_LOG_WARN("Couldn't create sysmon");
@ -155,6 +158,7 @@ void lv_sysmon_show_memory(lv_display_t * disp)
lv_obj_align(disp->mem_label, LV_USE_MEM_MONITOR_POS, 0, 0); lv_obj_align(disp->mem_label, LV_USE_MEM_MONITOR_POS, 0, 0);
lv_subject_add_observer_obj(&sysmon_mem.subject, mem_observer_cb, disp->mem_label, NULL); lv_subject_add_observer_obj(&sysmon_mem.subject, mem_observer_cb, disp->mem_label, NULL);
}
lv_obj_remove_flag(disp->mem_label, LV_OBJ_FLAG_HIDDEN); lv_obj_remove_flag(disp->mem_label, LV_OBJ_FLAG_HIDDEN);
} }