fix attempt at use-after-free

When a control which is focused is destroyed out-of-order, it gets a notification while it's user data it destroyed but not NULL.
This commit is contained in:
Raphael Coeffic
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent 475d068521
commit 071c657a7f
+2 -1
View File
@@ -195,6 +195,7 @@ Window::~Window()
if (children.size() > 0) deleteChildren();
if (lvobj != nullptr) {
lv_obj_set_user_data(lvobj, nullptr);
lv_obj_del(lvobj);
lvobj = nullptr;
}
@@ -269,8 +270,8 @@ void Window::clearLvgl()
if(window->lvobj != nullptr && window->lvobj->parent == lvobj)
window->clearLvgl();
}
// lv_obj_set_user_data(lvobj, nullptr);
lv_obj_set_user_data(lvobj, nullptr);
lvobj = nullptr;
}