core: use g_list_copy_deep for deep copying a GList

This commit is contained in:
Ben Chan
2017-06-23 22:32:07 +02:00
committed by Aleksander Morgado
parent 19794d0846
commit 8ad785925a
4 changed files with 8 additions and 14 deletions
+1 -5
View File
@@ -706,13 +706,9 @@ mm_base_modem_peek_best_data_port (MMBaseModem *self,
GList *
mm_base_modem_get_data_ports (MMBaseModem *self)
{
GList *copy;
g_return_val_if_fail (MM_IS_BASE_MODEM (self), NULL);
copy = g_list_copy (self->priv->data);
g_list_foreach (copy, (GFunc)g_object_ref, NULL);
return copy;
return g_list_copy_deep (self->priv->data, (GCopyFunc)g_object_ref, NULL);
}
GList *
+3 -2
View File
@@ -250,8 +250,9 @@ mm_bearer_list_disconnect_all_bearers (MMBearerList *self,
ctx = g_new0 (DisconnectAllContext, 1);
/* Get a copy of the list */
ctx->pending = g_list_copy (self->priv->bearers);
g_list_foreach (ctx->pending, (GFunc) g_object_ref, NULL);
ctx->pending = g_list_copy_deep (self->priv->bearers,
(GCopyFunc)g_object_ref,
NULL);
task = g_task_new (self, NULL, callback, user_data);
g_task_set_task_data (task,
+1 -2
View File
@@ -10353,8 +10353,7 @@ firmware_load_list (MMIfaceModemFirmware *_self,
firmware_load_list);
/* We'll return the new list of new references we create here */
dup = g_list_copy (self->priv->firmware_list);
g_list_foreach (dup, (GFunc)g_object_ref, NULL);
dup = g_list_copy_deep (self->priv->firmware_list, (GCopyFunc)g_object_ref, NULL);
g_simple_async_result_set_op_res_gpointer (result, dup, NULL);
g_simple_async_result_complete_in_idle (result);
+3 -5
View File
@@ -509,11 +509,9 @@ mm_device_peek_port_probe_list (MMDevice *self)
GList *
mm_device_get_port_probe_list (MMDevice *self)
{
GList *copy;
copy = g_list_copy (self->priv->port_probes);
g_list_foreach (copy, (GFunc)g_object_ref, NULL);
return copy;
return g_list_copy_deep (self->priv->port_probes,
(GCopyFunc)g_object_ref,
NULL);
}
gboolean