### 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
GrabModeAsync, GrabModeAsync, E.value.x11_window, None, CurrentTime);
					}
				}
#ifdef TOUCH_ENABLED
				
				/*for (int i = 0; i < xi.touch_devices.size(); ++i) {
					XIGrabDevice(x11_display, xi.touch_devices[i], x11_window, CurrentTime, None, XIGrabModeAsync, XIGrabModeAsync, False, &xi.touch_event_mask);
				}*/
#endif
				if (!app_focused) {
					if (OS::get_singleton()->get_main_loop()) {
						OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_FOCUS_IN);
					}
					app_focused = true;
				}
			} break;
			case FocusOut: {
				DEBUG_LOG_X11("[%u] FocusOut window=%lu (%u), mode='%u' \n", frame, event.xfocus.window, window_id, event.xfocus.mode);
				WindowData &wd = windows[window_id];
				if (ime_window_event || (event.xfocus.detail == NotifyInferior)) {
					break;
				}
				if (wd.ime_active) {
					MutexLock mutex_lock(events_mutex);
					XUnsetICFocus(wd.xic);
					XUnmapWindow(x11_display, wd.x11_xim_window);
					wd.ime_active = false;
					im_text = String();
					im_selection = Vector2i();
					OS_Unix::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);