### Godot version

Latest 4.0.dev (a3a42159e31db27f8ae7c1ecad6a9ed417cb05de)

### System information

Ubuntu 22.04.1 LTS

### Issue description

Ctrl+Shift+F (Find in Files) in the text editor, for example, causes my laptop to freeze consistently. I also reproduced it with F1 and Ctrl+Shift+R, as well as by using the dropdown instead of shortcuts.

### Steps to reproduce

Trivial

### Minimal reproduction project

N/A
return current_cursor;
}
void DisplayServerX11::cursor_set_custom_image(const Ref<Resource> &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
	_THREAD_SAFE_METHOD_
	if (p_cursor.is_valid()) {
		HashMap<CursorShape, Vector<Variant>>::Iterator cursor_c = cursors_cache.find(p_shape);
		if (cursor_c) {
			if (cursor_c->value[0] == p_cursor && cursor_c->value[1] == p_hotspot) {
				cursor_set_shape(p_shape);
				return;
			}
			cursors_cache.erase(p_shape);
		}
		Ref<Texture2D> texture = p_cursor;
		Ref<AtlasTexture> atlas_texture = p_cursor;
		Ref<Image> image;
		Size2i texture_size;
		Rect2i atlas_rect;
		if (texture.is_valid()) {
			image = texture->get_image();
		}
		if (!image.is_valid() && atlas_texture.is_valid()) {
			texture = atlas_texture->get_atlas();
			atlas_rect.size.width = texture->get_width();
			atlas_rect.size.height = texture->get_height();
			atlas_rect.position.x = atlas_texture->get_region().position.x;