Commit 299f298d authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

kimpanel: don't crash when ibus is already loaded

No need to replace the current engine if we already have an acceptable one set.

Otherwise it confuses Qt and it asserts in Qt.

 7  0x00007f517fcdf8e6 in qt_assert (assertion=assertion@entry=0x7f5179fee560 "engine_name == desc.engine_name", file=file@entry=0x7f5179fee318 "/home/apol/devel/frameworks/qt5/qtbase/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp",
    line=line@entry=583) at ../../include/QtCore/../../../../../devel/frameworks/qt5/qtbase/src/corelib/global/qlogging.h:90
 8  0x00007f5179fdb6f4 in QIBusPlatformInputContext::globalEngineChanged (this=0x55831b2c7ff0, engine_name=...) at ../../../../include/QtCore/../../../../../devel/frameworks/qt5/qtbase/src/corelib/tools/qarraydata.h:236
 9  0x00007f5179fe7f6d in QIBusPlatformInputContext::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at .moc/moc_qibusplatforminputcontext.cpp:147

Test Plan:
Now I can start the plasmoid without it crashing.
I'm guessing users so far were running against a release build of Qt without asserts.
Starting ibus with the session now works as well, in contrast to having to start it explicitly

Reviewers: hein

Reviewed By: hein

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent 3a6dc8c0
......@@ -505,6 +505,15 @@ impanel_get_default_engine(IBusPanelImpanel* impanel, char*** pengine_names, gsi
bool contains(gchar** strlist, const gchar* str)
for (; strlist; ++strlist) {
if (g_strcmp0(*strlist, str) == 0)
return true;
return false;
static void
impanel_update_engines(IBusPanelImpanel* impanel, GVariant* var_engines) {
gchar** engine_names = nullptr;
......@@ -524,13 +533,13 @@ impanel_update_engines(IBusPanelImpanel* impanel, GVariant* var_engines) {
IBusEngineDesc** engines = ibus_bus_get_engines_by_names(impanel->bus, engine_names);
if (engines && engines[0]) {
if (engines && engines[0] && !contains(engine_names, ibus_engine_desc_get_name(ibus_bus_get_global_engine(impanel->bus)))) {
ibus_bus_set_global_engine(impanel->bus, ibus_engine_desc_get_name(engines[0]));
impanel->app->setDoGrab(len > 1);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment