[MM] [PATCH] serial-port: avoid opening a serial port that has been disposed



---
 src/mm-serial-port.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index 0a8820d..dee2fec 100644
--- a/src/mm-serial-port.c
+++ b/src/mm-serial-port.c
@@ -849,6 +849,13 @@ mm_serial_port_open (MMSerialPort *self, GError **error)
 
     device = mm_port_get_device (MM_PORT (self));
 
+    /* If we forced closing the port, the MMSerialPort object has been disposed.
+     * Just return an error. */
+    if (priv->forced_close) {
+        mm_info ("(%s) skipped opening serial port that has been disposed", device);
+        return FALSE;
+    }
+
     if (priv->open_count) {
         /* Already open */
         goto success;
-- 
1.7.7.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]