### 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
ERR_FAIL_COND_MSG(p_id == MAIN_WINDOW_ID, "Main window can't be deleted");
	popup_close(p_id);
	WindowData &wd = windows[p_id];
	DEBUG_LOG_X11("delete_sub_window: %lu (%u) \n", wd.x11_window, p_id);
	while (wd.transient_children.size()) {
		window_set_transient(*wd.transient_children.begin(), INVALID_WINDOW_ID);
	}
	if (wd.transient_parent != INVALID_WINDOW_ID) {
		window_set_transient(p_id, INVALID_WINDOW_ID);
	}
#ifdef VULKAN_ENABLED
	if (context_vulkan) {
		context_vulkan->window_destroy(p_id);
	}
#endif
#ifdef GLES3_ENABLED
	if (gl_manager) {
		gl_manager->window_destroy(p_id);
	}
#endif
	XDestroyWindow(x11_display, wd.x11_xim_window);
	XUnmapWindow(x11_display, wd.x11_window);
	XDestroyWindow(x11_display, wd.x11_window);
	if (wd.xic) {
		XDestroyIC(wd.xic);
		wd.xic = nullptr;
	}
	windows.erase(p_id);
}
int64_t DisplayServerX11::window_get_native_handle(HandleType p_handle_type, WindowID p_window) const {