summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeng Xuetian <[email protected]>2019-01-03 12:15:16 -0800
committerWeng Xuetian <[email protected]>2019-01-03 12:15:38 -0800
commit3862d8530377b52f62b2def48047cccc0bc372d5 (patch)
tree70ee301c235b6871b2f04dbc4b30519054310ed9
parent9371a7c96d4722b93b49b18df7b21780f2a9ad38 (diff)
kimpanel: check engine_desc before use
-rw-r--r--applets/kimpanel/backend/ibus/ibus15/panel.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/applets/kimpanel/backend/ibus/ibus15/panel.cpp b/applets/kimpanel/backend/ibus/ibus15/panel.cpp
index 798d1c1..69a7c13 100644
--- a/applets/kimpanel/backend/ibus/ibus15/panel.cpp
+++ b/applets/kimpanel/backend/ibus/ibus15/panel.cpp
@@ -1066,9 +1066,11 @@ ibus_panel_impanel_focus_in (IBusPanelService *panel,
return;
}
- IBusEngineDesc *engine_desc = ibus_bus_get_global_engine(impanel->bus);
- impanel_update_logo_by_engine(impanel, engine_desc);
- g_object_unref(engine_desc);
+ auto engine_desc = ibus_bus_get_global_engine(impanel->bus);
+ if (engine_desc) {
+ impanel_update_logo_by_engine(impanel, engine_desc);
+ g_object_unref(engine_desc);
+ }
impanel->engineManager->setCurrentContext(input_context_path);
if (!impanel->engineManager->useGlobalEngine()) {
@@ -1120,9 +1122,13 @@ ibus_panel_impanel_real_register_properties(IBusPanelImpanel* impanel)
QByteArray propstr = ibus_engine_desc_to_logo_propstr(engine_desc);
g_variant_builder_add (&builder, "s", propstr.constData());
} else {
+ QByteArray propstr;
auto engine_desc = ibus_bus_get_global_engine(impanel->bus);
- QByteArray propstr = ibus_engine_desc_to_logo_propstr(engine_desc);
- g_variant_builder_add (&builder, "s", propstr.constData());
+ if (engine_desc) {
+ propstr = ibus_engine_desc_to_logo_propstr(engine_desc);
+ g_variant_builder_add (&builder, "s", propstr.constData());
+ g_object_unref(engine_desc);
+ }
IBusPropList* prop_list = impanel->propManager->properties();
if (prop_list) {
@@ -1132,7 +1138,6 @@ ibus_panel_impanel_real_register_properties(IBusPanelImpanel* impanel)
++i;
}
}
- g_object_unref(engine_desc);
}
g_dbus_connection_emit_signal (impanel->conn,