[gnome-builder] device-manager: make get_devices() transfer full



commit 8967c3f2a2f8063997968c4925367a5e962c9d7d
Author: Christian Hergert <chergert redhat com>
Date:   Mon Apr 9 15:51:18 2018 -0700

    device-manager: make get_devices() transfer full
    
    This makes things more consistent with other places we're switching to
    transfer-full.

 src/libide/devices/ide-device-manager.c  | 5 ++++-
 src/libide/devices/ide-device-provider.c | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/devices/ide-device-manager.c b/src/libide/devices/ide-device-manager.c
index d91dd1a45..4835c3d83 100644
--- a/src/libide/devices/ide-device-manager.c
+++ b/src/libide/devices/ide-device-manager.c
@@ -36,8 +36,9 @@
 #include "devices/ide-device-provider.h"
 #include "local/ide-local-device.h"
 #include "plugins/ide-extension-util.h"
-#include "util/ide-posix.h"
 #include "threading/ide-task.h"
+#include "util/ide-glib.h"
+#include "util/ide-posix.h"
 
 struct _IdeDeviceManager
 {
@@ -266,6 +267,7 @@ ide_device_manager_provider_added_cb (PeasExtensionSet *set,
                            G_CONNECT_SWAPPED);
 
   devices = ide_device_provider_get_devices (provider);
+  IDE_PTR_ARRAY_SET_FREE_FUNC (devices, g_object_unref);
 
   for (guint i = 0; i < devices->len; i++)
     {
@@ -302,6 +304,7 @@ ide_device_manager_provider_removed_cb (PeasExtensionSet *set,
   g_assert (IDE_IS_DEVICE_PROVIDER (provider));
 
   devices = ide_device_provider_get_devices (provider);
+  IDE_PTR_ARRAY_SET_FREE_FUNC (devices, g_object_unref);
 
   for (guint i = 0; i < devices->len; i++)
     {
diff --git a/src/libide/devices/ide-device-provider.c b/src/libide/devices/ide-device-provider.c
index 2d3228533..3845325fd 100644
--- a/src/libide/devices/ide-device-provider.c
+++ b/src/libide/devices/ide-device-provider.c
@@ -274,7 +274,7 @@ ide_device_provider_load_finish (IdeDeviceProvider  *self,
  * Gets a new #GPtrArray containing a list of #IdeDevice instances that were
  * registered by the #IdeDeviceProvider
  *
- * Returns: (transfer container) (element-type Ide.Device) (not nullable):
+ * Returns: (transfer full) (element-type Ide.Device) (not nullable):
  *   a #GPtrArray of #IdeDevice.
  *
  * Since: 3.28
@@ -287,7 +287,7 @@ ide_device_provider_get_devices (IdeDeviceProvider *self)
 
   g_return_val_if_fail (IDE_IS_DEVICE_PROVIDER (self), NULL);
 
-  devices = g_ptr_array_new_with_free_func (g_object_unref);
+  devices = g_ptr_array_new ();
 
   if (priv->devices != NULL)
     {


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