hso: avoid highly unlikely use of already unref-ed bearer

In the connection sequence, we make sure that the Bearer object is valid by
keeping a reference in the Dial3gppContext (actually, another one kept by the
GSimpleAsyncResult as well). But we are considering here the case where the
connection context is completed and freed by an unsolicited message handler
before we get the reply to the AT command, so to properly ensure that the bearer
object is still valid when we try to check if the context is in the priv struct,
we need to keep an extra ref around.
This commit is contained in:
Aleksander Morgado
2012-08-06 20:07:26 +02:00
parent 63a45f8082
commit 40730b115e
+4 -1
View File
@@ -465,6 +465,9 @@ activate_ready (MMBaseModem *modem,
* context was already completed and we have nothing else to do. */
ctx = self->priv->connect_pending;
/* Balance refcount with the extra ref we passed to command_full() */
g_object_unref (self);
if (!ctx) {
mm_dbg ("Connection context was finished already by an unsolicited message");
@@ -536,7 +539,7 @@ authenticate_ready (MMBaseModem *modem,
FALSE,
NULL, /* cancellable */
(GAsyncReadyCallback)activate_ready,
ctx->self); /* we pass the bearer object! */
g_object_ref (ctx->self)); /* we pass the bearer object! */
g_free (command);
}