### Godot version

0ddd9c3e8f9088fa139e25b2903289d727073e12

### System information

arch linux, google pixel 6

### Issue description

I've found that Android builds of projects are crashing when a touch release event occurs. This issue is only present when the `emulate_mouse_from_touch` setting is set to `false` in the project's settings, and a control node is present in the scene.

Expected result:

The touch release event should be registered without any crashes.

Actual result:

The android build crashes when a touch release event occurs.

### Steps to reproduce

- Create a new project
- Set `emulate_mouse_from_touch` setting to `false`
- Add a button to the main scene
- Build the project for android
- Run the project on android device
- Touch and release on the screen

### Minimal reproduction project

[android-touch-release-crash.zip](https://github.com/godotengine/godot/files/10432336/android-touch-release-crash.zip)

gui.sub_windows.remove_at(index);
	if (gui.sub_windows.size() == 0) {
		RS::get_singleton()->free(subwindow_canvas);
		subwindow_canvas = RID();
	}
	if (gui.subwindow_focused == p_window) {
		Window *new_focused_window;
		Window *parent_visible = p_window->get_parent_visible_window();
		gui.subwindow_drag = SUB_WINDOW_DRAG_DISABLED;
		gui.subwindow_focused->_event_callback(DisplayServer::WINDOW_EVENT_FOCUS_OUT);
		if (parent_visible) {
			new_focused_window = parent_visible;
		} else {
			new_focused_window = Object::cast_to<Window>(this);
		}
		if (new_focused_window) {
			int new_focused_index = _sub_window_find(new_focused_window);
			if (new_focused_index != -1) {
				gui.subwindow_focused = new_focused_window;
			} else {
				gui.subwindow_focused = nullptr;
			}
			new_focused_window->_event_callback(DisplayServer::WINDOW_EVENT_FOCUS_IN);
		} else {
			gui.subwindow_focused = nullptr;
		}
	}
	RenderingServer::get_singleton()->viewport_set_parent_viewport(p_window->viewport, p_window->parent ? p_window->parent->viewport : RID());
}
int Viewport::_sub_window_find(Window *p_window) {