### 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
atlas_rect.position.y = atlas_texture->get_region().position.y;
			texture_size.width = atlas_texture->get_region().size.x;
			texture_size.height = atlas_texture->get_region().size.y;
		} else if (image.is_valid()) {
			texture_size.width = texture->get_width();
			texture_size.height = texture->get_height();
		}
		ERR_FAIL_COND(!texture.is_valid());
		ERR_FAIL_COND(p_hotspot.x < 0 || p_hotspot.y < 0);
		ERR_FAIL_COND(texture_size.width > 256 || texture_size.height > 256);
		ERR_FAIL_COND(p_hotspot.x > texture_size.width || p_hotspot.y > texture_size.height);
		image = texture->get_image();
		ERR_FAIL_COND(!image.is_valid());
		
		XcursorImage *cursor_image = XcursorImageCreate(texture_size.width, texture_size.height);
		XcursorUInt image_size = texture_size.width * texture_size.height;
		XcursorDim size = sizeof(XcursorPixel) * image_size;
		cursor_image->version = 1;
		cursor_image->size = size;
		cursor_image->xhot = p_hotspot.x;
		cursor_image->yhot = p_hotspot.y;
		
		cursor_image->pixels = (XcursorPixel *)memalloc(size);
		for (XcursorPixel index = 0; index < image_size; index++) {
			int row_index = floor(index / texture_size.width) + atlas_rect.position.y;
			int column_index = (index % int(texture_size.width)) + atlas_rect.position.x;
			if (atlas_texture.is_valid()) {
				column_index = MIN(column_index, atlas_rect.size.width - 1);
				row_index = MIN(row_index, atlas_rect.size.height - 1);
			}