[gegl/wip/rishi/my-patches: 8/8] operation-context: Replace ambiguous	method name
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gegl/wip/rishi/my-patches: 8/8] operation-context: Replace ambiguous	method name
- Date: Tue, 21 Nov 2017 17:58:09 +0000 (UTC)
commit 3cb3c04ae2bcdc694793db68f499df6736ec19b5
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Nov 21 18:34:03 2017 +0100
    operation-context: Replace ambiguous method name
    
    The gegl_operation_context_get_source method is misleading. It is a
    thin wrapper around gegl_operation_context_get_object. Therefore it
    can be used to get both the input and output buffers, which doesn't
    match with the "source" in its name. Secondly, unlike most "get"
    methods it returns "transfer full", not "transfer none", which can
    cause reference counting bugs.
    
    Address this by deprecating gegl_operation_context_get_source and
    adding a gegl_operation_context_dup_object method.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790675
 gegl/operation/gegl-operation-context.c |   22 +++++++++++++++-------
 gegl/operation/gegl-operation-context.h |    2 ++
 2 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-context.c b/gegl/operation/gegl-operation-context.c
index 430b1ff..74429ed 100644
--- a/gegl/operation/gegl-operation-context.c
+++ b/gegl/operation/gegl-operation-context.c
@@ -250,6 +250,19 @@ gegl_operation_context_take_object (GeglOperationContext *context,
 }
 
 GObject *
+gegl_operation_context_dup_object (GeglOperationContext *context,
+                                   const gchar          *padname)
+{
+  GObject *ret;
+
+  ret = gegl_operation_context_get_object (context, padname);
+  if (ret != NULL)
+    g_object_ref (ret);
+
+  return ret;
+}
+
+GObject *
 gegl_operation_context_get_object (GeglOperationContext *context,
                                    const gchar          *padname)
 {
@@ -274,14 +287,9 @@ GeglBuffer *
 gegl_operation_context_get_source (GeglOperationContext *context,
                                    const gchar          *padname)
 {
-  GeglBuffer     *real_input;
-  GeglBuffer     *input;
-
-  real_input = GEGL_BUFFER (gegl_operation_context_get_object (context, padname));
-  if (!real_input)
-    return NULL;
-  input = g_object_ref (real_input);
+  GeglBuffer *input;
 
+  input = GEGL_BUFFER (gegl_operation_context_dup_object (context, padname));
   return input;
 }
 
diff --git a/gegl/operation/gegl-operation-context.h b/gegl/operation/gegl-operation-context.h
index e15a738..1437620 100644
--- a/gegl/operation/gegl-operation-context.h
+++ b/gegl/operation/gegl-operation-context.h
@@ -26,6 +26,8 @@ G_BEGIN_DECLS
 GeglBuffer     *gegl_operation_context_get_target      (GeglOperationContext *self,
                                                         const gchar          *padname);
 GeglBuffer     *gegl_operation_context_get_source      (GeglOperationContext *self,
+                                                        const gchar          *padname) G_GNUC_DEPRECATED;
+GObject        *gegl_operation_context_dup_object      (GeglOperationContext *self,
                                                         const gchar          *padname);
 GObject        *gegl_operation_context_get_object      (GeglOperationContext *context,
                                                         const gchar          *padname);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]