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.
/* 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);
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)
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);