summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;