### Godot version

2992ffd25523cb8b3e0ef1b873c40115b8940178

### System information

Windows 10

### Issue description

Godot crashes randomly within a few seconds after project start when moving with the mouse.

![win_err](https://github.com/godotengine/godot/assets/52464204/1da28596-d95b-40f3-b32f-12219ec02c5d)

Started after recent merge of https://github.com/godotengine/godot/pull/67791.
I can confirm that reverting the pr fixes the crashes.

### Steps to reproduce

see desc

### Minimal reproduction project

N/A
ERR_MAIN_THREAD_GUARD;
	set_visible(false);
}
void Window::set_visible(bool p_visible) {
	ERR_MAIN_THREAD_GUARD;
	if (visible == p_visible) {
		return;
	}
	if (!is_inside_tree()) {
		visible = p_visible;
		return;
	}
	ERR_FAIL_COND_MSG(get_parent() == nullptr, "Can't change visibility of main window.");
	visible = p_visible;
	
	updating_child_controls = false;
	Viewport *embedder_vp = get_embedder();
	if (!embedder_vp) {
		if (!p_visible && window_id != DisplayServer::INVALID_WINDOW_ID) {
			_clear_window();
		}
		if (p_visible && window_id == DisplayServer::INVALID_WINDOW_ID) {
			_make_window();
		}
	} else {
		if (visible) {
			embedder = embedder_vp;
			if (initial_position != WINDOW_INITIAL_POSITION_ABSOLUTE) {
				position = (embedder->get_visible_rect().size - size) / 2;
			}