Checking the saved focus widget's parent in focus_in can lead to use
after free if the widget was deleted in the meantime.
if(i==children.end())
throw hierarchy_error("widget not in container");
+ if(&wdg==saved_input_focus)
+ saved_input_focus = nullptr;
wdg.set_parent(nullptr);
delete *i;
children.erase(i);
void Container::focus_in()
{
- if(saved_input_focus && saved_input_focus->get_parent()==this)
+ if(saved_input_focus)
set_input_focus(saved_input_focus);
Widget::focus_in();
}