### 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
_THREAD_SAFE_METHOD_
	WindowData &wd = windows[MAIN_WINDOW_ID];
	int (*oldHandler)(Display *, XErrorEvent *) = XSetErrorHandler(&set_icon_errorhandler);
	Atom net_wm_icon = XInternAtom(x11_display, "_NET_WM_ICON", False);
	if (p_icon.is_valid()) {
		Ref<Image> img = p_icon->duplicate();
		img->convert(Image::FORMAT_RGBA8);
		while (true) {
			int w = img->get_width();
			int h = img->get_height();
			if (g_set_icon_error) {
				g_set_icon_error = false;
				WARN_PRINT("Icon too large, attempting to resize icon.");
				int new_width, new_height;
				if (w > h) {
					new_width = w / 2;
					new_height = h * new_width / w;
				} else {
					new_height = h / 2;
					new_width = w * new_height / h;
				}
				w = new_width;
				h = new_height;
				if (!w || !h) {
					WARN_PRINT("Unable to set icon.");
					break;
				}
				img->resize(w, h, Image::INTERPOLATE_CUBIC);