mm-provider: Cancel ongoing operations
both when MM has appeared on DBus and when disposing of the provider.
This commit is contained in:
@@ -50,6 +50,8 @@ struct _CallsMMProvider {
|
|||||||
MMManager *mm;
|
MMManager *mm;
|
||||||
/* A list of CallsOrigins */
|
/* A list of CallsOrigins */
|
||||||
GListStore *origins;
|
GListStore *origins;
|
||||||
|
|
||||||
|
GCancellable *cancellable;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void calls_mm_provider_message_source_interface_init (CallsMessageSourceInterface *iface);
|
static void calls_mm_provider_message_source_interface_init (CallsMessageSourceInterface *iface);
|
||||||
@@ -310,9 +312,13 @@ mm_appeared_cb (GDBusConnection *connection,
|
|||||||
{
|
{
|
||||||
g_debug ("ModemManager appeared on D-Bus");
|
g_debug ("ModemManager appeared on D-Bus");
|
||||||
|
|
||||||
|
g_cancellable_cancel (self->cancellable);
|
||||||
|
g_clear_object (&self->cancellable);
|
||||||
|
self->cancellable = g_cancellable_new ();
|
||||||
|
|
||||||
mm_manager_new (connection,
|
mm_manager_new (connection,
|
||||||
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
|
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
|
||||||
NULL,
|
self->cancellable,
|
||||||
(GAsyncReadyCallback) mm_manager_new_cb,
|
(GAsyncReadyCallback) mm_manager_new_cb,
|
||||||
self);
|
self);
|
||||||
}
|
}
|
||||||
@@ -390,6 +396,9 @@ dispose (GObject *object)
|
|||||||
{
|
{
|
||||||
CallsMMProvider *self = CALLS_MM_PROVIDER (object);
|
CallsMMProvider *self = CALLS_MM_PROVIDER (object);
|
||||||
|
|
||||||
|
g_cancellable_cancel (self->cancellable);
|
||||||
|
g_clear_object (&self->cancellable);
|
||||||
|
|
||||||
g_clear_object (&self->mm);
|
g_clear_object (&self->mm);
|
||||||
|
|
||||||
g_clear_handle_id (&self->watch_id, g_bus_unwatch_name);
|
g_clear_handle_id (&self->watch_id, g_bus_unwatch_name);
|
||||||
|
Reference in New Issue
Block a user