### 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
mb.instantiate();
				mb->set_window_id(window_id);
				_get_key_modifier_state(event.xbutton.state, mb);
				mb->set_button_index((MouseButton)event.xbutton.button);
				if (mb->get_button_index() == MouseButton::RIGHT) {
					mb->set_button_index(MouseButton::MIDDLE);
				} else if (mb->get_button_index() == MouseButton::MIDDLE) {
					mb->set_button_index(MouseButton::RIGHT);
				}
				mb->set_button_mask(_get_mouse_button_state(mb->get_button_index(), event.xbutton.type));
				mb->set_position(Vector2(event.xbutton.x, event.xbutton.y));
				mb->set_global_position(mb->get_position());
				mb->set_pressed((event.type == ButtonPress));
				const WindowData &wd = windows[window_id];
				if (event.type == ButtonPress) {
					DEBUG_LOG_X11("[%u] ButtonPress window=%lu (%u), button_index=%u \n", frame, event.xbutton.window, window_id, mb->get_button_index());
					
					
					
					if (!wd.no_focus && !wd.is_popup) {
						XSetInputFocus(x11_display, wd.x11_window, RevertToPointerRoot, CurrentTime);
					}
					uint64_t diff = OS::get_singleton()->get_ticks_usec() / 1000 - last_click_ms;
					if (mb->get_button_index() == last_click_button_index) {
						if (diff < 400 && Vector2(last_click_pos).distance_to(Vector2(event.xbutton.x, event.xbutton.y)) < 5) {
							last_click_ms = 0;
							last_click_pos = Point2i(-100, -100);
							last_click_button_index = MouseButton::NONE;
							mb->set_double_click(true);
						}