### 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
} else if (mb->get_button_index() < MouseButton::WHEEL_UP || mb->get_button_index() > MouseButton::WHEEL_RIGHT) {
						last_click_button_index = mb->get_button_index();
					}
					if (!mb->is_double_click()) {
						last_click_ms += diff;
						last_click_pos = Point2i(event.xbutton.x, event.xbutton.y);
					}
				} else {
					DEBUG_LOG_X11("[%u] ButtonRelease window=%lu (%u), button_index=%u \n", frame, event.xbutton.window, window_id, mb->get_button_index());
					WindowID window_id_other = INVALID_WINDOW_ID;
					Window wd_other_x11_window;
					if (wd.focused) {
						
						WindowID popup_id = _get_focused_window_or_popup();
						if (popup_id != INVALID_WINDOW_ID && popup_id != window_id) {
							window_id_other = popup_id;
							wd_other_x11_window = windows[popup_id].x11_window;
						}
					} else {
						
						
						
						
						
						for (const KeyValue<WindowID, WindowData> &E : windows) {
							if (E.value.focused) {
								if (E.key != window_id) {
									window_id_other = E.key;
									wd_other_x11_window = E.value.x11_window;
								}