Fix crash when hiding subwindow during popup of new subwindow
(cherry picked from commit e2cea458a3
)
This commit is contained in:
parent
2c9901af36
commit
96b8861c9d
|
@ -364,6 +364,7 @@ void Viewport::_sub_window_grab_focus(Window *p_window) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The index needs to be update before every usage in case an event callback changed the window list.
|
||||||
int index = _sub_window_find(p_window);
|
int index = _sub_window_find(p_window);
|
||||||
ERR_FAIL_COND(index == -1);
|
ERR_FAIL_COND(index == -1);
|
||||||
|
|
||||||
|
@ -375,6 +376,8 @@ void Viewport::_sub_window_grab_focus(Window *p_window) {
|
||||||
gui.subwindow_drag = SUB_WINDOW_DRAG_DISABLED;
|
gui.subwindow_drag = SUB_WINDOW_DRAG_DISABLED;
|
||||||
}
|
}
|
||||||
// Can only move to foreground, but no focus granted.
|
// Can only move to foreground, but no focus granted.
|
||||||
|
index = _sub_window_find(p_window);
|
||||||
|
ERR_FAIL_COND(index == -1);
|
||||||
SubWindow sw = gui.sub_windows[index];
|
SubWindow sw = gui.sub_windows[index];
|
||||||
gui.sub_windows.remove_at(index);
|
gui.sub_windows.remove_at(index);
|
||||||
gui.sub_windows.push_back(sw);
|
gui.sub_windows.push_back(sw);
|
||||||
|
@ -402,6 +405,8 @@ void Viewport::_sub_window_grab_focus(Window *p_window) {
|
||||||
gui.subwindow_focused->_event_callback(DisplayServer::WINDOW_EVENT_FOCUS_IN);
|
gui.subwindow_focused->_event_callback(DisplayServer::WINDOW_EVENT_FOCUS_IN);
|
||||||
|
|
||||||
{ // Move to foreground.
|
{ // Move to foreground.
|
||||||
|
index = _sub_window_find(p_window);
|
||||||
|
ERR_FAIL_COND(index == -1);
|
||||||
SubWindow sw = gui.sub_windows[index];
|
SubWindow sw = gui.sub_windows[index];
|
||||||
gui.sub_windows.remove_at(index);
|
gui.sub_windows.remove_at(index);
|
||||||
gui.sub_windows.push_back(sw);
|
gui.sub_windows.push_back(sw);
|
||||||
|
|
Loading…
Reference in New Issue