summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Xu <martin.xu@intel.com>2010-03-23 11:43:50 +0800
committerSamuel Ortiz <sameo@linux.intel.com>2010-03-23 12:05:52 +0100
commit449a6aa318165cc8e39ced502a221ee16bbb2abb (patch)
treeae943dab4ce5f4629fb3b006927321b112405e0c
parent678e15dba2930464631ddca47b42a9d8473b1175 (diff)
downloadconnman-449a6aa318165cc8e39ced502a221ee16bbb2abb.tar.gz
connman-449a6aa318165cc8e39ced502a221ee16bbb2abb.tar.bz2
connman-449a6aa318165cc8e39ced502a221ee16bbb2abb.zip
Set network->device as NULL when the device is removed
oFono plugin can use network->device to decide whether the modem is removed during active PrimaryContext. That fixes a segmentation fault when removing a 3G modem before getting the set_network_active() D-Bus reply.
-rw-r--r--plugins/ofono.c4
-rw-r--r--src/device.c2
-rw-r--r--src/network.c3
3 files changed, 7 insertions, 2 deletions
diff --git a/plugins/ofono.c b/plugins/ofono.c
index c5521efb..2ad01f24 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -398,8 +398,10 @@ static gboolean pending_network_is_available(
/* Modem may be removed during waiting for active reply */
device = connman_network_get_device(pending_network);
- if (device == NULL)
+ if (device == NULL) {
+ DBG("Modem is removed");
return FALSE;
+ }
identifier = connman_network_get_identifier(pending_network);
diff --git a/src/device.c b/src/device.c
index f9dbe865..6aeed017 100644
--- a/src/device.c
+++ b/src/device.c
@@ -656,6 +656,8 @@ static void unregister_network(gpointer data)
connman_element_unregister((struct connman_element *) network);
connman_network_unref(network);
+
+ __connman_network_set_device(network, NULL);
}
static void device_destruct(struct connman_element *element)
diff --git a/src/network.c b/src/network.c
index 3fca7bb9..8fb0ea02 100644
--- a/src/network.c
+++ b/src/network.c
@@ -237,7 +237,8 @@ static void unregister_interface(struct connman_element *element)
network->registered = FALSE;
- emit_networks_signal(network->device);
+ if (network->device != NULL)
+ emit_networks_signal(network->device);
g_dbus_unregister_interface(connection, element->path,
CONNMAN_NETWORK_INTERFACE);