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:
committed by
Raphael Coeffic
parent
475d068521
commit
071c657a7f
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user