1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-09-29 15:25:24 +00:00

mm-provider: Cancel ongoing operations

both when MM has appeared on DBus and
when disposing of the provider.
This commit is contained in:
Evangelos Ribeiro Tzaras 2022-09-03 11:06:59 +02:00
parent 79401f6227
commit 662befeb48

View file

@ -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);