[gnome-builder/gnome-builder-41] flatpak: be more explicit about invocation transfer



commit 87944337482b7e2fde9f3a0a902b2854d7bdbe6e
Author: Christian Hergert <chergert redhat com>
Date:   Thu Nov 18 14:15:13 2021 -0800

    flatpak: be more explicit about invocation transfer

 src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c 
b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
index 9b35b96dc..7a8322668 100644
--- a/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
+++ b/src/plugins/flatpak/daemon/ipc-flatpak-service-impl.c
@@ -492,7 +492,7 @@ ipc_flatpak_service_impl_list_runtimes (IpcFlatpakService     *service,
     }
 
   ipc_flatpak_service_complete_list_runtimes (service,
-                                              invocation,
+                                              g_steal_pointer (&invocation),
                                               g_variant_builder_end (&builder));
 
   return TRUE;
@@ -603,7 +603,7 @@ ipc_flatpak_service_impl_runtime_is_known (IpcFlatpakService     *service,
 
   /* Parse the ref, so we can try to locate it */
   if (!(ref = flatpak_ref_parse (full_name, &error)))
-    return complete_wrapped_error (invocation, error);
+    return complete_wrapped_error (g_steal_pointer (&invocation), error);
 
   ref_name = flatpak_ref_get_name (ref);
   ref_arch = flatpak_ref_get_arch (ref);
@@ -618,7 +618,9 @@ ipc_flatpak_service_impl_runtime_is_known (IpcFlatpakService     *service,
           str_equal0 (ref_arch, runtime->arch) &&
           str_equal0 (ref_branch, runtime->branch))
         {
-          ipc_flatpak_service_complete_runtime_is_known (service, invocation, TRUE, 0);
+          ipc_flatpak_service_complete_runtime_is_known (service,
+                                                         g_steal_pointer (&invocation),
+                                                         TRUE, 0);
           return TRUE;
         }
     }
@@ -1013,13 +1015,17 @@ on_install_completed_cb (IpcFlatpakServiceImpl *self,
                          GParamSpec            *pspec,
                          GTask                 *task)
 {
-  GDBusMethodInvocation *invocation;
+  g_autoptr(GDBusMethodInvocation) invocation = NULL;
   GHashTableIter iter;
   Install *install;
 
   g_assert (IPC_IS_FLATPAK_SERVICE_IMPL (self));
   g_assert (G_IS_TASK (task));
 
+  /* Steal the invocation object */
+  invocation = g_object_ref (g_object_get_data (G_OBJECT (task), "INVOCATION"));
+  g_object_set_data (G_OBJECT (task), "INVOCATION", NULL);
+
   if (g_task_had_error (task))
     return;
 
@@ -1036,9 +1042,8 @@ on_install_completed_cb (IpcFlatpakServiceImpl *self,
     }
 
   /* Now notify the client */
-  invocation = g_object_get_data (G_OBJECT (task), "INVOCATION");
   ipc_flatpak_service_complete_install (IPC_FLATPAK_SERVICE (self),
-                                        g_object_ref (invocation));
+                                        g_steal_pointer (&invocation));
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]