Fix: Convert HSO plugin to new world order
authorDenis Kenzior <denkenz@gmail.com>
Wed, 2 Dec 2009 23:55:40 +0000 (17:55 -0600)
committerDenis Kenzior <denkenz@gmail.com>
Thu, 3 Dec 2009 01:11:35 +0000 (19:11 -0600)
plugins/hso.c

index 6293d84..e30a2c5 100644 (file)
@@ -72,6 +72,7 @@ static void hso_remove(struct ofono_modem *modem)
 
        ofono_modem_set_data(modem, NULL);
 
+       g_at_chat_unref(data->control);
        g_free(data);
 }
 
@@ -166,10 +167,6 @@ static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
        g_at_chat_unref(data->control);
        data->control = NULL;
 
-       g_at_chat_shutdown(data->app);
-       g_at_chat_unref(data->app);
-       data->app = NULL;
-
        if (ok)
                ofono_modem_set_powered(modem, FALSE);
 }
@@ -183,6 +180,13 @@ static int hso_disable(struct ofono_modem *modem)
        if (!data->control)
                return 0;
 
+       g_at_chat_cancel_all(data->control);
+       g_at_chat_unregister_all(data->control);
+
+       g_at_chat_shutdown(data->app);
+       g_at_chat_unref(data->app);
+       data->app = NULL;
+
        g_at_chat_send(data->control, "AT+CFUN=0", none_prefix,
                                        cfun_disable, modem, NULL);