Skip to content

Commit

Permalink
Make mouse_focus and mouse_focus_mask consistent for force_drag
Browse files Browse the repository at this point in the history
In `Viewport::_gui_force_drag` currently `Viewport::gui.mouse_focus`
gets cleared, but `Viewport::gui.mouse_focus_mask` doesn't get cleared.

This is an inconsistency which can cause a crash.

With the change of this PR, `mouse_focus_mask` also gets cleared.
This is in alignment with how regular drag and drop clears both variables.
  • Loading branch information
Sauermann committed May 1, 2024
1 parent 92e726d commit 30a19a5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2318,6 +2318,7 @@ void Viewport::_gui_force_drag(Control *p_base, const Variant &p_data, Control *
gui.dragging = true;
gui.drag_data = p_data;
gui.mouse_focus = nullptr;
gui.mouse_focus_mask.clear();

if (p_control) {
_gui_set_drag_preview(p_base, p_control);
Expand Down

0 comments on commit 30a19a5

Please sign in to comment.