port-serial: don't assume connected_id signal handler is always connected

If the signal is automatically disconnected during object disposal, we
shouldn't explicitly try to disconnect it ourselves during finalize().

Reported by: Lubomir Rintel <lkundrak@v3.sk>
This commit is contained in:
Aleksander Morgado
2019-09-04 12:19:20 +00:00
committed by Aleksander Morgado
parent f6d5490eeb
commit f684c7130a
+4 -1
View File
@@ -1387,7 +1387,10 @@ _close_internal (MMPortSerial *self, gboolean force)
return;
if (self->priv->connected_id) {
g_signal_handler_disconnect (self, self->priv->connected_id);
/* Don't assume it's always connected, because it may be automatically connected during
* object disposal, and this method is also called in finalize() */
if (g_signal_handler_is_connected (self, self->priv->connected_id))
g_signal_handler_disconnect (self, self->priv->connected_id);
self->priv->connected_id = 0;
}