summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-09-18 11:21:03 -0700
committerMarcel Holtmann <marcel@holtmann.org>2009-09-18 11:21:03 -0700
commit6d88e7eeeeb395a10a4fb31bcf2b52c87f13772c (patch)
tree9d0a4cfb1cce7aa1b67a31da57e8f318b85cd141 /plugins
parent1a1914cca17478ae694059bf47f433cc62dedb0b (diff)
downloadconnman-6d88e7eeeeb395a10a4fb31bcf2b52c87f13772c.tar.gz
connman-6d88e7eeeeb395a10a4fb31bcf2b52c87f13772c.tar.bz2
connman-6d88e7eeeeb395a10a4fb31bcf2b52c87f13772c.zip
Destroy the AT chat object only when modem got disabled
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mbm.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/mbm.c b/plugins/mbm.c
index 3acd9c1f..4b58ea4e 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -436,8 +436,14 @@ static void cfun_disable(gboolean ok, GAtResult *result,
gpointer user_data)
{
struct connman_device *device = user_data;
+ struct mbm_data *data = connman_device_get_data(device);
connman_device_set_powered(device, FALSE);
+
+ if (data->chat != NULL) {
+ g_at_chat_unref(data->chat);
+ data->chat = NULL;
+ }
}
static void cfun_query(gboolean ok, GAtResult *result,
@@ -588,6 +594,11 @@ static void mbm_remove(struct connman_device *device)
connman_rtnl_remove_watch(data->watch);
+ if (data->chat != NULL) {
+ g_at_chat_unref(data->chat);
+ data->chat = NULL;
+ }
+
g_free(data->imsi);
g_free(data);
}
@@ -662,9 +673,6 @@ static int mbm_disable(struct connman_device *device)
index = connman_device_get_index(device);
connman_inet_ifdown(index);
- g_at_chat_unref(data->chat);
- data->chat = NULL;
-
return -EINPROGRESS;
}