<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
> I examined the references of the port and they all seemed ok. The actual<br>
> issue may be the following:<br>
><br>
> 1. data_available() calls mm_serial_port_close_force() to force close a<br>
> port upon receiving G_IO_HUP. priv->forced_close is set to TRUE.<br>
> 2. The connection/disconnection sequence still holds a reference to the<br>
> port and eventually triggers the port to be re-opened. However,<br>
> mm_serial_port_open() doesn't reset priv->forced_close to FALSE.<br>
> 3. When the port is no longer referenced, dispose() calls<br>
> mm_serial_port_close_force(), which does nothing because priv->forced_close<br>
> is TRUE.<br>
> 4. priv->watch_id is still active and eventually calls data_available()<br>
> after the port is finalized. data_available() accesses priv->queue and<br>
> crashes.<br>
><br>
> We can either (1) reset priv->forced_close to FALSE in mm_serial_port_open,<br>
> or (2) fail open/repoen if priv->forced_close is TRUE. (1) assumes it's ok<br>
> to repoen a force-closed port while (2) doesn't. Dan / Aleksander, which<br>
> semantic do you prefer?<br>
><br>
<br>
</div></div>Forced-close is done only when the port gets removed (i.e. we get a<br>
HUP); so I'd suggest to go for option #2 (i.e. error if trying to reopen<br>
a forced-closed port).<br></blockquote><div><br></div><div>Sounds good to me. I've submitted a new patch to do that. </div></div></div></div>