### 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
RenderingServer *rendering_server = RenderingServer::get_singleton();
	if (rendering_server) {
		max_size = rendering_server->get_maximum_viewport_size();
		max_size_used = max_size; 
	}
	theme_owner = memnew(ThemeOwner);
	RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_DISABLED);
}
Window::~Window() {
	memdelete(theme_owner);
	
	for (KeyValue<StringName, Ref<Texture2D>> &E : theme_icon_override) {
		E.value->disconnect_changed(callable_mp(this, &Window::_notify_theme_override_changed));
	}
	for (KeyValue<StringName, Ref<StyleBox>> &E : theme_style_override) {
		E.value->disconnect_changed(callable_mp(this, &Window::_notify_theme_override_changed));
	}
	for (KeyValue<StringName, Ref<Font>> &E : theme_font_override) {
		E.value->disconnect_changed(callable_mp(this, &Window::_notify_theme_override_changed));
	}
	
	theme_icon_override.clear();
	theme_style_override.clear();
	theme_font_override.clear();
	theme_font_size_override.clear();
	theme_color_override.clear();
	theme_constant_override.clear();
}