Nux

Merge lp:~brandontschaefer/nux/lp.1047944-fix into lp:nux

Proposed by Brandon Schaefer
Status: Merged
Approved by: Christopher Townsend
Approved revision: 815
Merged at revision: 817
Proposed branch: lp:~brandontschaefer/nux/lp.1047944-fix
Merge into: lp:nux
Diff against target: 58 lines (+25/-9)
1 file modified
Nux/InputMethodIBus.cpp (+25/-9)
To merge this branch: bzr merge lp:~brandontschaefer/nux/lp.1047944-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Marco Trevisan (Treviño) Approve
Review via email: mp+186121@code.launchpad.net

Commit message

Gracefully handle ibus_bus_get_config returning NULL

Description of the change

ibus_bus_get_config can return NULL in two cases:
1) !ibus_bus_is_connected
2) The configuration daemon at dbus name org.freedesktop.IBus.Config is
   not available

The current nux code does not gracefully handle NULL being returned, and
crashes, as can be seen in bug 1047944.

Fixed by mterry in this branch:
https://code.launchpad.net/~mterry/nux/null-ibus-config/+merge/129212

Outdated, as we missed reviewing it :(, re-did the branch!

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

+1

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

Seems to be some transient issue. Re-approving.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nux/InputMethodIBus.cpp'
2--- Nux/InputMethodIBus.cpp 2013-08-01 00:05:21 +0000
3+++ Nux/InputMethodIBus.cpp 2013-09-17 17:57:19 +0000
4@@ -165,8 +165,14 @@
5 UpdateCursorLocation();
6
7 IBusConfig* bus_conf = ibus_bus_get_config(bus_);
8- g_signal_handlers_disconnect_by_func(bus_conf, reinterpret_cast<gpointer>(OnConfigChanged_), this);
9- g_signal_connect(bus_conf, "value-changed", G_CALLBACK(OnConfigChanged_), this);
10+
11+ // may be null if not connected to bus or can't get ibus name
12+ if (bus_conf)
13+ {
14+ g_signal_handlers_disconnect_by_func(bus_conf, reinterpret_cast<gpointer>(OnConfigChanged_), this);
15+ g_signal_connect(bus_conf, "value-changed", G_CALLBACK(OnConfigChanged_), this);
16+ }
17+
18 UpdateHotkeys();
19 }
20
21@@ -177,7 +183,12 @@
22 if (ibus_bus_is_connected(bus_))
23 {
24 IBusConfig* bus_conf = ibus_bus_get_config(bus_);
25- g_signal_handlers_disconnect_by_func(bus_conf, reinterpret_cast<gpointer>(OnConfigChanged_), this);
26+
27+ // may be null if not connected to bus or can't get ibus name
28+ if (bus_conf)
29+ {
30+ g_signal_handlers_disconnect_by_func(bus_conf, reinterpret_cast<gpointer>(OnConfigChanged_), this);
31+ }
32 }
33
34 if (!context_)
35@@ -481,12 +492,17 @@
36 void IBusIMEContext::UpdateHotkeys()
37 {
38 IBusConfig* conf = ibus_bus_get_config(bus_);
39- GVariant* val = ibus_config_get_value(conf, "general/hotkey", "triggers");
40- const gchar** keybindings = g_variant_get_strv(val, NULL);
41-
42- hotkeys_ = ParseIBusHotkeys(keybindings);
43-
44- g_variant_unref(val);
45+
46+ // may be null if not connected to bus or can't get ibus name
47+ if (conf)
48+ {
49+ GVariant* val = ibus_config_get_value(conf, "general/hotkey", "triggers");
50+ const gchar** keybindings = g_variant_get_strv(val, NULL);
51+
52+ hotkeys_ = ParseIBusHotkeys(keybindings);
53+
54+ g_variant_unref(val);
55+ }
56 }
57
58 bool IBusIMEContext::IsHotkeyEvent(EventType type, unsigned long keysym, unsigned long modifiers) const

Subscribers

People subscribed via source and target branches