### 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
count++;
				}
			}
		}
		if (count > 0) {
			ds->im_selection = Point2i(start + call_data->chg_first, count);
		} else {
			ds->im_selection = Point2i(call_data->caret, 0);
		}
	} else {
		ds->im_text = String();
		ds->im_selection = Point2i();
	}
	if (wd.ime_active) {
		OS_Unix::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_IME_UPDATE);
	}
}
void DisplayServerX11::_xim_preedit_caret_callback(::XIM xim, ::XPointer client_data,
		::XIMPreeditCaretCallbackStruct *call_data) {
}
void DisplayServerX11::_xim_destroy_callback(::XIM im, ::XPointer client_data,
		::XPointer call_data) {
	WARN_PRINT("Input method stopped");
	DisplayServerX11 *ds = reinterpret_cast<DisplayServerX11 *>(client_data);
	ds->xim = nullptr;
	for (KeyValue<WindowID, WindowData> &E : ds->windows) {
		E.value.xic = nullptr;
	}
}
void DisplayServerX11::_window_changed(XEvent *event) {