### 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
DisplayServerX11 *display_server = static_cast<DisplayServerX11 *>(ud);
	display_server->_poll_events();
}
Bool DisplayServerX11::_predicate_all_events(Display *display, XEvent *event, XPointer arg) {
	
	return True;
}
bool DisplayServerX11::_wait_for_events() const {
	int x11_fd = ConnectionNumber(x11_display);
	fd_set in_fds;
	XFlush(x11_display);
	FD_ZERO(&in_fds);
	FD_SET(x11_fd, &in_fds);
	struct timeval tv;
	tv.tv_usec = 0;
	tv.tv_sec = 1;
	
	int num_ready_fds = select(x11_fd + 1, &in_fds, nullptr, nullptr, &tv);
	if (num_ready_fds > 0) {
		
		return true;
	} else {
		
		if (num_ready_fds < 0) {
			ERR_PRINT("_wait_for_events: select error: " + itos(errno));
		}
		return false;
	}
}
void DisplayServerX11::_poll_events() {