aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-04-18 17:39:59 -0500
committerDan Williams <dcbw@redhat.com>2011-04-18 17:39:59 -0500
commit74b1503c602e1268b5199ef36c9611d7cb08adc1 (patch)
treef3557beea09be07b70475487a25cccf9abaec774 /src
parentfca4d3aa37e9a22921d1b7cfb93325bf6cc91f4e (diff)
core: tear down all pending work when closing a port
Make sure all pending work, if any, is torn down when closing the port, since it's closed, and is likely going to get unreffed soon and we don't want anything running after the port is dead.
Diffstat (limited to 'src')
-rw-r--r--src/mm-serial-port.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index 8b683dd3..18a616d9 100644
--- a/src/mm-serial-port.c
+++ b/src/mm-serial-port.c
@@ -837,6 +837,8 @@ mm_serial_port_close (MMSerialPort *self)
priv->connected_id = 0;
}
+ mm_serial_port_flash_cancel (self);
+
if (priv->fd >= 0) {
GTimeVal tv_start, tv_end;
@@ -852,8 +854,6 @@ mm_serial_port_close (MMSerialPort *self)
priv->channel = NULL;
}
- mm_serial_port_flash_cancel (self);
-
g_get_current_time (&tv_start);
tcsetattr (priv->fd, TCSANOW, &priv->old_t);
@@ -901,6 +901,16 @@ mm_serial_port_close (MMSerialPort *self)
g_slice_free (MMQueueData, item);
}
g_queue_clear (priv->queue);
+
+ if (priv->timeout_id) {
+ g_source_remove (priv->timeout_id);
+ priv->timeout_id = 0;
+ }
+
+ if (priv->queue_id) {
+ g_source_remove (priv->queue_id);
+ priv->queue_id = 0;
+ }
}
void