summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-06-29 14:59:47 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-07-03 16:08:58 +0200
commitf69785ff789dedc2387bf15e6de42f1b1b0924fb (patch)
tree19bfa56cdfc749edd4475c76cdd607ee4a6bb7ee
parentc39691742ed6ddec842efba62c855f26846a149a (diff)
device: ensure we remove the watch when closing the channel
-rw-r--r--src/qmi-device.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qmi-device.c b/src/qmi-device.c
index 113c087..36bdf44 100644
--- a/src/qmi-device.c
+++ b/src/qmi-device.c
@@ -1302,7 +1302,12 @@ destroy_iochannel (QmiDevice *self,
/* Failures when closing still make the device to get closed */
g_io_channel_unref (self->priv->iochannel);
self->priv->iochannel = NULL;
- self->priv->watch_id = 0;
+
+ if (self->priv->watch_id) {
+ g_source_remove (self->priv->watch_id);
+ self->priv->watch_id = 0;
+ }
+
if (self->priv->response) {
g_byte_array_unref (self->priv->response);
self->priv->response = NULL;