### 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
RasterizerGLES3::make_current();
		} else {
			memdelete(gl_manager);
			gl_manager = nullptr;
			r_error = ERR_UNAVAILABLE;
			return;
		}
	}
#endif
	if (!driver_found) {
		r_error = ERR_UNAVAILABLE;
		ERR_FAIL_MSG("Video driver not found");
	}
	Point2i window_position;
	if (p_position != nullptr) {
		window_position = *p_position;
	} else {
		if (p_screen == SCREEN_OF_MAIN_WINDOW) {
			p_screen = SCREEN_PRIMARY;
		}
		window_position = screen_get_position(p_screen) + (screen_get_size(p_screen) - p_resolution) / 2;
	}
	WindowID main_window = _create_window(p_mode, p_vsync_mode, p_flags, Rect2i(window_position, p_resolution));
	if (main_window == INVALID_WINDOW_ID) {
		r_error = ERR_CANT_CREATE;
		return;
	}
	for (int i = 0; i < WINDOW_FLAG_MAX; i++) {
		if (p_flags & (1 << i)) {
			window_set_flag(WindowFlags(i), true, main_window);