aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mm-iface-modem-3gpp-profile-manager.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/mm-iface-modem-3gpp-profile-manager.c b/src/mm-iface-modem-3gpp-profile-manager.c
index 67601ada..1ab01487 100644
--- a/src/mm-iface-modem-3gpp-profile-manager.c
+++ b/src/mm-iface-modem-3gpp-profile-manager.c
@@ -674,15 +674,29 @@ mm_iface_modem_3gpp_profile_manager_set_profile (MMIfaceModem3gppProfileManager
GAsyncReadyCallback callback,
gpointer user_data)
{
- GTask *task;
- SetProfileContext *ctx;
- MMBearerIpFamily ip_family;
+ GError *error;
+ GTask *task;
+ SetProfileContext *ctx;
+ MMBearerIpFamily ip_family;
+ g_autoptr(GVariant) dict = NULL;
+ g_autoptr(MM3gppProfile) requested_copy = NULL;
task = g_task_new (self, NULL, callback, user_data);
+ /* The MM3gppProfile passed to the SetProfileContext is going to
+ * be modified, so we make a copy to preserve the original one. */
+ dict = mm_3gpp_profile_get_dictionary (requested);
+ requested_copy = mm_3gpp_profile_new_from_dictionary (dict, &error);
+ if (!requested_copy) {
+ g_prefix_error (&error, "Couldn't copy 3GPP profile:");
+ g_task_return_error (task, error);
+ g_object_unref (task);
+ return;
+ }
+
ctx = g_slice_new0 (SetProfileContext);
ctx->step = SET_PROFILE_STEP_FIRST;
- ctx->requested = g_object_ref (requested);
+ ctx->requested = g_object_ref (requested_copy);
ctx->index_field = g_strdup (index_field);
ctx->strict = strict;
ctx->profile_id = mm_3gpp_profile_get_profile_id (requested);