mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-01 07:00:55 +00:00
nitpicker: invalidate dangling hovered ptr
This patch adds the missing invalidation of the _hovered pointer to User_state::forget, which is required to cover the situation where the owner of the hovered view vanishes. Fixes #4011
This commit is contained in:
parent
d29b843a0f
commit
b5fb37ddee
@ -396,23 +396,29 @@ User_state::Handle_forget_result User_state::forget(View_owner const &owner)
|
|||||||
_focus.forget(owner);
|
_focus.forget(owner);
|
||||||
|
|
||||||
bool const need_to_update_all_views = (&owner == _focused);
|
bool const need_to_update_all_views = (&owner == _focused);
|
||||||
bool const focus_changed = &owner == _focused;
|
bool const focus_vanished = (&owner == _focused);
|
||||||
|
bool const hover_vanished = (&owner == _hovered);
|
||||||
|
|
||||||
if (&owner == _focused) _focused = nullptr;
|
auto wipe_ptr = [&] (auto &ptr) {
|
||||||
if (&owner == _next_focused) _next_focused = nullptr;
|
if (&owner == ptr)
|
||||||
if (&owner == _last_clicked) _last_clicked = nullptr;
|
ptr = nullptr; };
|
||||||
|
|
||||||
|
wipe_ptr(_focused);
|
||||||
|
wipe_ptr(_next_focused);
|
||||||
|
wipe_ptr(_last_clicked);
|
||||||
|
wipe_ptr(_hovered);
|
||||||
|
|
||||||
Update_hover_result const update_hover_result = update_hover();
|
Update_hover_result const update_hover_result = update_hover();
|
||||||
|
|
||||||
if (_input_receiver == &owner)
|
wipe_ptr(_input_receiver);
|
||||||
_input_receiver = nullptr;
|
|
||||||
|
|
||||||
if (need_to_update_all_views)
|
if (need_to_update_all_views)
|
||||||
_view_stack.update_all_views();
|
_view_stack.update_all_views();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
.hover_changed = update_hover_result.hover_changed,
|
.hover_changed = update_hover_result.hover_changed
|
||||||
.focus_changed = focus_changed,
|
| hover_vanished,
|
||||||
|
.focus_changed = focus_vanished,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user