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.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user