Nux

Merge lp:~mterry/nux/null-ibus-config into lp:nux

Proposed by Michael Terry
Status: Rejected
Rejected by: Brandon Schaefer
Proposed branch: lp:~mterry/nux/null-ibus-config
Merge into: lp:nux
Diff against target: 36 lines (+10/-3)
1 file modified
Nux/InputMethodIBus.cpp (+10/-3)
To merge this branch: bzr merge lp:~mterry/nux/null-ibus-config
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Tim Penhey (community) Needs Fixing
Review via email: mp+129212@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.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Can I get you to add a comment in the code just before the if statement saying why it may be null? Just like you did in the description. That'd help anyone coming to this code later.

Cheers,
Tim

review: Needs Fixing
lp:~mterry/nux/null-ibus-config updated
688. By Michael Terry

add some comments explaining how ibus config might be null

689. By Michael Terry

merge from trunk

Revision history for this message
Michael Terry (mterry) wrote :

Done. Please reconsider, thanks!

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:689
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mterry/nux/null-ibus-config/+merge/129212/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/nux-ci/9/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/nux-raring-amd64-ci/9
    SUCCESS: http://jenkins.qa.ubuntu.com/job/nux-raring-armhf-ci/9
    SUCCESS: http://jenkins.qa.ubuntu.com/job/nux-raring-i386-ci/9

Click here to trigger a rebuild:
http://s-jenkins:8080/job/nux-ci/9/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote :

poke

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Sorry I missed this... It now has conflicts, but it does indeed handle that bug :). So i've made a new branch just get this fix in here:

https://code.launchpad.net/~brandontschaefer/nux/lp.1047944-fix/+merge/186121

Thanks again!

Unmerged revisions

689. By Michael Terry

merge from trunk

688. By Michael Terry

add some comments explaining how ibus config might be null

687. By Michael Terry

handle NULL return from ibus_bus_get_config

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 2012-10-01 23:37:25 +0000
3+++ Nux/InputMethodIBus.cpp 2012-11-15 23:38:21 +0000
4@@ -165,8 +165,11 @@
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+ if (bus_conf) // may be null if not connected to bus or can't get ibus name
11+ {
12+ g_signal_handlers_disconnect_by_func(bus_conf, reinterpret_cast<gpointer>(OnConfigChanged_), this);
13+ g_signal_connect(bus_conf, "value-changed", G_CALLBACK(OnConfigChanged_), this);
14+ }
15 UpdateHotkeys();
16 }
17
18@@ -177,7 +180,8 @@
19 if (ibus_bus_is_connected(bus_))
20 {
21 IBusConfig* bus_conf = ibus_bus_get_config(bus_);
22- g_signal_handlers_disconnect_by_func(bus_conf, reinterpret_cast<gpointer>(OnConfigChanged_), this);
23+ if (bus_conf) // may be null if not connected to bus or can't get ibus name
24+ g_signal_handlers_disconnect_by_func(bus_conf, reinterpret_cast<gpointer>(OnConfigChanged_), this);
25 }
26
27 if (!context_)
28@@ -484,6 +488,9 @@
29 void IBusIMEContext::UpdateHotkeys()
30 {
31 IBusConfig* conf = ibus_bus_get_config(bus_);
32+ if (!conf) // may be null if not connected to bus or can't get ibus name
33+ return;
34+
35 GVariant* val = ibus_config_get_value(conf, "general", "hotkey/trigger");
36 const gchar** keybindings = g_variant_get_strv(val, NULL);
37

Subscribers

People subscribed via source and target branches