bearer-qmi: avoid increasing self reference during dispose()

The reset_bearer_connection() method is called during dispose, and if
a link had been created during the connection attempt, we would be
increasing the reference to the bearer object during dispose(), which
should never happen.

Just avoid passing any callback to the cleanup_link() method, as we
really were using that only for logging purposes.
This commit is contained in:
Aleksander Morgado
2021-03-11 11:20:48 +01:00
parent a772b70632
commit fdfcd30308

View File

@@ -2216,18 +2216,6 @@ disconnect_finish (MMBaseBearer *self,
return g_task_propagate_boolean (G_TASK (res), error); return g_task_propagate_boolean (G_TASK (res), error);
} }
static void
cleanup_link_ready (MMPortQmi *qmi,
GAsyncResult *res,
MMBearerQmi *self) /* full reference */
{
g_autoptr(GError) error = NULL;
if (!mm_port_qmi_cleanup_link_finish (qmi, res, &error))
mm_obj_warn (self, "couldn't cleanup link: %s", error->message);
g_object_unref (self);
}
static void static void
reset_bearer_connection (MMBearerQmi *self, reset_bearer_connection (MMBearerQmi *self,
gboolean reset_ipv4, gboolean reset_ipv4,
@@ -2278,8 +2266,8 @@ reset_bearer_connection (MMBearerQmi *self,
mm_port_qmi_cleanup_link (self->priv->qmi, mm_port_qmi_cleanup_link (self->priv->qmi,
mm_port_get_device (self->priv->link), mm_port_get_device (self->priv->link),
self->priv->mux_id, self->priv->mux_id,
(GAsyncReadyCallback) cleanup_link_ready, NULL,
g_object_ref (self)); NULL);
g_clear_object (&self->priv->link); g_clear_object (&self->priv->link);
} }
self->priv->mux_id = QMI_DEVICE_MUX_ID_UNBOUND; self->priv->mux_id = QMI_DEVICE_MUX_ID_UNBOUND;