https://github.com/fcitx/fcitx-qt5/commit/6f2033c497fe0da1fd197bc3be35695b11eafd93 --- /platforminputcontext/qfcitxplatforminputcontext.cpp +++ /platforminputcontext/qfcitxplatforminputcontext.cpp @@ -291,8 +291,21 @@ return; } if (proxy) { - cursorRectChanged(); proxy->focusIn(); + // We need to delegate this otherwise it may cause self-recursion in + // certain application like libreoffice. + auto window = m_lastWindow; + QMetaObject::invokeMethod( + this, + [this, window]() { + if (window != m_lastWindow) { + return; + } + if (auto *proxy = validICByWindow(window.data())) { + cursorRectChanged(); + } + }, + Qt::QueuedConnection); } }