[PATCH 2/2] MM: internal_queue_command(): Reject new commands when the port is closed.



This is the actual crasher.

    - Nathan
From 3cd611e30fce4b572ab7f89cca876dff3362cd36 Mon Sep 17 00:00:00 2001
From: Nathan Williams <njw chromium org>
Date: Thu, 3 Nov 2011 16:21:45 -0400
Subject: [PATCH 2/2] internal_queue_command(): Reject new commands when the port is closed.

Otherwise, we can schedule a main loop call to
mm_serial_port_queue_process() for an object that's about to
disappear, leading to a crash.

Change-Id: I433a76855c52536eb2b99a5ecf26ac71afe1f8bb
---
 src/mm-serial-port.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mm-serial-port.c b/src/mm-serial-port.c
index b116997..2d07214 100644
--- a/src/mm-serial-port.c
+++ b/src/mm-serial-port.c
@@ -969,6 +969,7 @@ internal_queue_command (MMSerialPort *self,
     MMQueueData *info;
 
     g_return_if_fail (MM_IS_SERIAL_PORT (self));
+    g_return_if_fail (priv->open_count > 0);
     g_return_if_fail (command != NULL);
 
     info = g_slice_new0 (MMQueueData);
-- 
1.7.3.1



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