diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2014-07-28 22:31:26 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2014-07-31 18:42:52 +0200 |
commit | 1888013fec1579996c77f8ff8fc41baba418bec4 (patch) | |
tree | f857a4cac9c4add0a42cad921bdcf28d0fd7691b /src/libmbim-glib/mbim-proxy.c | |
parent | 082d61b4777c5840d6089e7c6a37d49ca4e1c5e2 (diff) |
libmbim-glib,proxy: untrack device if it wasn't opened properly
Diffstat (limited to 'src/libmbim-glib/mbim-proxy.c')
-rw-r--r-- | src/libmbim-glib/mbim-proxy.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/libmbim-glib/mbim-proxy.c b/src/libmbim-glib/mbim-proxy.c index 042a28d..69f8094 100644 --- a/src/libmbim-glib/mbim-proxy.c +++ b/src/libmbim-glib/mbim-proxy.c @@ -66,6 +66,7 @@ struct _MbimProxyPrivate { }; static void track_device (MbimProxy *self, MbimDevice *device); +static void untrack_device (MbimProxy *self, MbimDevice *device); static MbimDevice *peek_device_for_path (MbimProxy *self, const gchar *path); /*****************************************************************************/ @@ -441,8 +442,11 @@ device_open_ready (MbimDevice *device, /* Complete all pending open actions */ opening_device_complete_and_free (info, error); - if (error) + if (error) { + /* Fully untrack the device as it wasn't correctly open */ + untrack_device (self, device); g_error_free (error); + } } static void @@ -1197,10 +1201,18 @@ static void proxy_device_removed_cb (MbimDevice *device, MbimProxy *self) { + untrack_device (self, device); +} + +static void +untrack_device (MbimProxy *self, + MbimDevice *device) +{ GList *l; GList *to_remove = NULL; - g_assert (g_list_find (self->priv->devices, device)); + if (!g_list_find (self->priv->devices, device)) + return; /* Disconnect right away */ g_signal_handlers_disconnect_by_func (device, proxy_device_removed_cb, self); |