### 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
}
	}
	show_window(main_window);
#if defined(VULKAN_ENABLED)
	if (rendering_driver == "vulkan") {
		
		rendering_device_vulkan = memnew(RenderingDeviceVulkan);
		rendering_device_vulkan->initialize(context_vulkan);
		RendererCompositorRD::make_current();
	}
#endif
	{
		
		XIEventMask all_master_event_mask;
		static unsigned char all_master_mask_data[XIMaskLen(XI_LASTEVENT)] = {};
		all_master_event_mask.deviceid = XIAllMasterDevices;
		all_master_event_mask.mask_len = sizeof(all_master_mask_data);
		all_master_event_mask.mask = all_master_mask_data;
		XISetMask(all_master_event_mask.mask, XI_DeviceChanged);
		XISetMask(all_master_event_mask.mask, XI_RawMotion);
		XISelectEvents(x11_display, DefaultRootWindow(x11_display), &all_master_event_mask, 1);
	}
	cursor_size = XcursorGetDefaultSize(x11_display);
	cursor_theme = XcursorGetTheme(x11_display);
	if (!cursor_theme) {
		print_verbose("XcursorGetTheme could not get cursor theme");
		cursor_theme = "default";
	}
	for (int i = 0; i < CURSOR_MAX; i++) {
		static const char *cursor_file[] = {