timer del segfault fix
This commit is contained in:
parent
d0877672a3
commit
bf08fc69ff
@ -21,7 +21,13 @@ static int units_num;
|
||||
static uint16_t workspace_index = 0;
|
||||
static lv_obj_t* ws_label;
|
||||
|
||||
static lv_timer_t* volume_readout_update_timer;
|
||||
static lv_timer_t* volume_readout_update_timer = NULL;
|
||||
|
||||
static void delete_timer(lv_timer_t** timer){
|
||||
if(*timer == NULL) return;
|
||||
lv_timer_del(*timer);
|
||||
*timer = NULL;
|
||||
}
|
||||
|
||||
void volume_readout_update(lv_timer_t* timer){
|
||||
for(int i = 0; i < units_num; i++){
|
||||
@ -51,7 +57,7 @@ static void run_handler(lv_event_t * e){
|
||||
else{
|
||||
lv_label_set_text(label, LV_SYMBOL_PLAY);
|
||||
pse_sp_stop_all(units, units_num);
|
||||
lv_timer_del(volume_readout_update_timer);
|
||||
delete_timer(&volume_readout_update_timer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -101,7 +107,7 @@ static void unit_widget_clicked_handler(lv_event_t* e){
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
if(volume_readout_update_timer != NULL) lv_timer_del(volume_readout_update_timer);
|
||||
if(volume_readout_update_timer != NULL) delete_timer(&volume_readout_update_timer);
|
||||
pse_unit* unit = lv_event_get_user_data(e);
|
||||
PSE_unit_edit_screen_Gen(units, unit, units_num, workspace_index);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user