base-modem-at: make abort_task_if_port_unusable() unref the GTask
Aleksander seems to prefer it this way. Looks better. Suggested-by: Aleksander Morgado <aleksandermj@chromium.org>
This commit is contained in:

committed by
Aleksander Morgado

parent
f0a77a2292
commit
da55fa769e
@@ -35,6 +35,7 @@ abort_task_if_port_unusable (MMBaseModem *self,
|
|||||||
MM_CORE_ERROR,
|
MM_CORE_ERROR,
|
||||||
MM_CORE_ERROR_NOT_FOUND,
|
MM_CORE_ERROR_NOT_FOUND,
|
||||||
"Cannot run sequence: port not given");
|
"Cannot run sequence: port not given");
|
||||||
|
g_object_unref (task);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@ abort_task_if_port_unusable (MMBaseModem *self,
|
|||||||
MM_CORE_ERROR,
|
MM_CORE_ERROR,
|
||||||
MM_CORE_ERROR_CONNECTED,
|
MM_CORE_ERROR_CONNECTED,
|
||||||
"Cannot run sequence: port is connected");
|
"Cannot run sequence: port is connected");
|
||||||
|
g_object_unref (task);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,6 +62,7 @@ abort_task_if_port_unusable (MMBaseModem *self,
|
|||||||
"Cannot run sequence: '%s'",
|
"Cannot run sequence: '%s'",
|
||||||
error->message);
|
error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
|
g_object_unref (task);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,10 +238,8 @@ at_sequence_common (MMBaseModem *self,
|
|||||||
AtSequenceContext *ctx;
|
AtSequenceContext *ctx;
|
||||||
|
|
||||||
/* Ensure that we have an open port */
|
/* Ensure that we have an open port */
|
||||||
if (!abort_task_if_port_unusable (self, port, task)) {
|
if (!abort_task_if_port_unusable (self, port, task))
|
||||||
g_object_unref (task);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Setup context */
|
/* Setup context */
|
||||||
ctx = g_new0 (AtSequenceContext, 1);
|
ctx = g_new0 (AtSequenceContext, 1);
|
||||||
@@ -540,10 +541,8 @@ at_command_common (MMBaseModem *self,
|
|||||||
AtCommandContext *ctx;
|
AtCommandContext *ctx;
|
||||||
|
|
||||||
/* Ensure that we have an open port */
|
/* Ensure that we have an open port */
|
||||||
if (!abort_task_if_port_unusable (self, port, task)) {
|
if (!abort_task_if_port_unusable (self, port, task))
|
||||||
g_object_unref (task);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
ctx = g_new0 (AtCommandContext, 1);
|
ctx = g_new0 (AtCommandContext, 1);
|
||||||
ctx->port = g_object_ref (port);
|
ctx->port = g_object_ref (port);
|
||||||
|
Reference in New Issue
Block a user