1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

lv_del_obj: fix if delted while pressed

This commit is contained in:
Gabor Kiss-Vamosi 2018-04-14 22:06:13 +02:00
parent 913517f19d
commit 8bc5770c28
2 changed files with 16 additions and 11 deletions

View File

@ -292,17 +292,9 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
/* Reset all input devices if
* the currently pressed object is deleted*/
lv_indev_t * indev = lv_indev_next(NULL);
lv_obj_t * dpar;
while(indev) {
dpar = obj;
while(dpar != NULL) {
if(indev->proc.act_obj == dpar ||
indev->proc.last_obj == dpar) {
lv_indev_reset(indev);
break;
} else {
dpar = lv_obj_get_parent(dpar);
}
if(indev->proc.act_obj == obj || indev->proc.last_obj == obj) {
lv_indev_reset(indev);
}
indev = lv_indev_next(indev);
}
@ -1591,6 +1583,16 @@ static void delete_children(lv_obj_t * obj)
if(obj->group_p != NULL) lv_group_remove_obj(obj);
#endif
/* Reset the input devices if
* the currently pressed object is deleted*/
lv_indev_t * indev = lv_indev_next(NULL);
while(indev) {
if(indev->proc.act_obj == obj || indev->proc.last_obj == obj) {
lv_indev_reset(indev);
}
indev = lv_indev_next(indev);
}
/*Remove the object from parent's children list*/
lv_obj_t * par = lv_obj_get_parent(obj);
lv_ll_rem(&(par->child_ll), obj);

View File

@ -1044,7 +1044,10 @@ static void pwd_char_hider(lv_obj_t * ta)
int16_t len = lv_txt_get_length(txt);
bool refr = false;
uint16_t i;
for(i = 0; i < len; i++) txt[i] = '*';
for(i = 0; i < len; i++) {
txt[i] = '*';
refr = true;
}
txt[i] = '\0';