diff options
author | Kuba Pawlak <kubax.t.pawlak@intel.com> | 2015-07-10 17:08:01 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2015-07-12 21:19:31 -0500 |
commit | 71df8bb15e75705cab659e679fbe0b6f8c52bbf7 (patch) | |
tree | 084482b6b40ff6cdcc8c59497e48123d04d3e962 /plugins | |
parent | 35ebbf4c976348206adeee64b4e41dfcab608a8a (diff) | |
download | ofono-71df8bb15e75705cab659e679fbe0b6f8c52bbf7.tar.bz2 |
hfp_hf_bluez5: Fix crash on re-pairing a Device
It may happen that a Device object is unpaired an paired again
without being removed from DBus. This in turn triggers second
modem object to be created, but not fully initialized.
If this modem object is used, oFono will crash.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/hfp_hf_bluez5.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c index 5ee70c55..713c7896 100644 --- a/plugins/hfp_hf_bluez5.c +++ b/plugins/hfp_hf_bluez5.c @@ -738,8 +738,17 @@ static void modem_register_from_proxy(GDBusProxy *proxy, const char *path) return; dbus_message_iter_get_basic(&iter, &paired); - if (paired == FALSE) + + if (paired == FALSE) { + modem = ofono_modem_find(device_path_compare, (void *) path); + + if (modem != NULL) { + ofono_modem_remove(modem); + g_dbus_proxy_set_removed_watch(proxy, NULL, NULL); + g_dbus_proxy_set_property_watch(proxy, NULL, NULL); + } return; + } if (g_dbus_proxy_get_property(proxy, "UUIDs", &iter) == FALSE) return; |