[at-spi2-atk] Removed the extra boolean parameter added to know when to unref the AtkObject passed as parameter. I



commit 62ef943cbe84b8293bd99910a6a01d432d122eb5
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Wed Jun 23 09:06:28 2010 -0400

    Removed the extra boolean parameter added to know when to unref the
    AtkObject passed as parameter. Instead, just do g_object_unref() when
    needed out of that function, right after calling it.
    
    Updated all callers
    
    Bug #28659

 atk-adaptor/adaptors/accessible-adaptor.c |   10 ++++++----
 atk-adaptor/adaptors/cache-adaptor.c      |    4 +---
 atk-adaptor/adaptors/component-adaptor.c  |    6 +++++-
 atk-adaptor/adaptors/hyperlink-adaptor.c  |    2 +-
 atk-adaptor/adaptors/selection-adaptor.c  |    6 +++++-
 atk-adaptor/adaptors/table-adaptor.c      |   10 +++++++---
 atk-adaptor/object.c                      |    4 +---
 atk-adaptor/object.h                      |    2 +-
 8 files changed, 27 insertions(+), 17 deletions(-)
---
diff --git a/atk-adaptor/adaptors/accessible-adaptor.c b/atk-adaptor/adaptors/accessible-adaptor.c
index 1983807..c2c60e9 100644
--- a/atk-adaptor/adaptors/accessible-adaptor.c
+++ b/atk-adaptor/adaptors/accessible-adaptor.c
@@ -156,6 +156,7 @@ impl_GetChildAtIndex (DBusConnection * bus,
                       DBusMessage * message, void *user_data)
 {
   AtkObject *object = (AtkObject *) user_data;
+  DBusMessage *reply;
   DBusError error;
   dbus_int32_t i;
   AtkObject *child;
@@ -177,7 +178,6 @@ impl_GetChildAtIndex (DBusConnection * bus,
       child_path = g_utf8_strchr (child_name + 1, -1, ':');
       if (child_path)
         {
-          DBusMessage *reply;
           DBusMessageIter iter, iter_socket;
           *(child_path++) = '\0';
           reply = dbus_message_new_method_return (message);
@@ -194,7 +194,10 @@ impl_GetChildAtIndex (DBusConnection * bus,
       g_free (child_name);
     }
   child = atk_object_ref_accessible_child (object, i);
-  return spi_object_return_reference (message, child, TRUE);
+  reply = spi_object_return_reference (message, child);
+  g_object_unref (child);
+
+  return reply;
 }
 
 static DBusMessage *
@@ -495,8 +498,7 @@ static DBusMessage *
 impl_GetApplication (DBusConnection * bus,
                      DBusMessage * message, void *user_data)
 {
-  AtkObject *root = g_object_ref (atk_get_root ());
-  return spi_object_return_reference (message, root, TRUE);
+  return spi_object_return_reference (message, atk_get_root ());
 }
 
 static DBusMessage *
diff --git a/atk-adaptor/adaptors/cache-adaptor.c b/atk-adaptor/adaptors/cache-adaptor.c
index 7eb69e4..edbcb7b 100644
--- a/atk-adaptor/adaptors/cache-adaptor.c
+++ b/atk-adaptor/adaptors/cache-adaptor.c
@@ -279,9 +279,7 @@ emit_cache_add (SpiCache *cache, GObject * obj)
 static DBusMessage *
 impl_GetRoot (DBusConnection * bus, DBusMessage * message, void *user_data)
 {
-  return spi_object_return_reference (message,
-                                      g_object_ref (G_OBJECT (spi_global_app_data->root)),
-                                      TRUE);
+  return spi_object_return_reference (message, spi_global_app_data->root);
 }
 
 /*---------------------------------------------------------------------------*/
diff --git a/atk-adaptor/adaptors/component-adaptor.c b/atk-adaptor/adaptors/component-adaptor.c
index 5726c6f..a0e16ad 100644
--- a/atk-adaptor/adaptors/component-adaptor.c
+++ b/atk-adaptor/adaptors/component-adaptor.c
@@ -67,6 +67,7 @@ impl_GetAccessibleAtPoint (DBusConnection * bus, DBusMessage * message,
   AtkComponent *component = (AtkComponent *) user_data;
   dbus_int32_t x, y;
   dbus_uint32_t coord_type;
+  DBusMessage *reply;
   DBusError error;
   AtkObject *child;
 
@@ -83,7 +84,10 @@ impl_GetAccessibleAtPoint (DBusConnection * bus, DBusMessage * message,
   child =
     atk_component_ref_accessible_at_point (component, x, y,
                                            (AtkCoordType) coord_type);
-  return spi_object_return_reference (message, child, TRUE);
+  reply = spi_object_return_reference (message, child);
+  g_object_unref (child);
+
+  return child;
 }
 
 static DBusMessage *
diff --git a/atk-adaptor/adaptors/hyperlink-adaptor.c b/atk-adaptor/adaptors/hyperlink-adaptor.c
index 124d01c..cd0a924 100644
--- a/atk-adaptor/adaptors/hyperlink-adaptor.c
+++ b/atk-adaptor/adaptors/hyperlink-adaptor.c
@@ -81,7 +81,7 @@ impl_GetObject (DBusConnection * bus, DBusMessage * message, void *user_data)
       return droute_invalid_arguments_error (message);
     }
   atk_object = atk_hyperlink_get_object (link, i);
-  return spi_object_return_reference (message, atk_object, FALSE);
+  return spi_object_return_reference (message, atk_object);
 }
 
 static DBusMessage *
diff --git a/atk-adaptor/adaptors/selection-adaptor.c b/atk-adaptor/adaptors/selection-adaptor.c
index 0f6b722..353113d 100644
--- a/atk-adaptor/adaptors/selection-adaptor.c
+++ b/atk-adaptor/adaptors/selection-adaptor.c
@@ -53,6 +53,7 @@ impl_GetSelectedChild (DBusConnection * bus, DBusMessage * message,
                        void *user_data)
 {
   AtkSelection *selection = (AtkSelection *) user_data;
+  DBusMessage *reply;
   DBusError error;
   dbus_int32_t selectedChildIndex;
   AtkObject *atk_object;
@@ -67,7 +68,10 @@ impl_GetSelectedChild (DBusConnection * bus, DBusMessage * message,
       return droute_invalid_arguments_error (message);
     }
   atk_object = atk_selection_ref_selection (selection, selectedChildIndex);
-  return spi_object_return_reference (message, atk_object, TRUE);
+  reply = spi_object_return_reference (message, atk_object);
+  g_object_unref (atk_object);
+
+  return reply;
 }
 
 static DBusMessage *
diff --git a/atk-adaptor/adaptors/table-adaptor.c b/atk-adaptor/adaptors/table-adaptor.c
index d54ebce..59d45e8 100644
--- a/atk-adaptor/adaptors/table-adaptor.c
+++ b/atk-adaptor/adaptors/table-adaptor.c
@@ -95,6 +95,7 @@ impl_GetAccessibleAt (DBusConnection * bus, DBusMessage * message,
 {
   AtkTable *table = (AtkTable *) user_data;
   dbus_int32_t row, column;
+  DBusMessage *reply;
   DBusError error;
   AtkObject *obj;
 
@@ -108,7 +109,10 @@ impl_GetAccessibleAt (DBusConnection * bus, DBusMessage * message,
       return droute_invalid_arguments_error (message);
     }
   obj = atk_table_ref_at (table, row, column);
-  return spi_object_return_reference (message, obj, TRUE);
+  reply = spi_object_return_reference (message, obj);
+  g_object_unref (obj);
+
+  return reply;
 }
 
 static DBusMessage *
@@ -331,7 +335,7 @@ impl_GetRowHeader (DBusConnection * bus, DBusMessage * message,
       return droute_invalid_arguments_error (message);
     }
   obj = atk_table_get_row_header (table, row);
-  return spi_object_return_reference (message, obj, FALSE);
+  return spi_object_return_reference (message, obj);
 }
 
 static DBusMessage *
@@ -352,7 +356,7 @@ impl_GetColumnHeader (DBusConnection * bus, DBusMessage * message,
       return droute_invalid_arguments_error (message);
     }
   obj = atk_table_get_column_header (table, column);
-  return spi_object_return_reference (message, obj, FALSE);
+  return spi_object_return_reference (message, obj);
 }
 
 static DBusMessage *
diff --git a/atk-adaptor/object.c b/atk-adaptor/object.c
index 7ad7f92..3511682 100644
--- a/atk-adaptor/object.c
+++ b/atk-adaptor/object.c
@@ -175,7 +175,7 @@ spi_object_append_desktop_reference (DBusMessageIter * iter)
 }
 
 DBusMessage *
-spi_object_return_reference (DBusMessage * msg, AtkObject * obj, gboolean unref)
+spi_object_return_reference (DBusMessage * msg, AtkObject * obj)
 {
   DBusMessage *reply;
 
@@ -186,8 +186,6 @@ spi_object_return_reference (DBusMessage * msg, AtkObject * obj, gboolean unref)
       dbus_message_iter_init_append (reply, &iter);
       spi_object_append_reference (&iter, obj);
     }
-  if (unref && obj)
-    g_object_unref (G_OBJECT (obj));
 
   return reply;
 }
diff --git a/atk-adaptor/object.h b/atk-adaptor/object.h
index eb38564..3b27292 100644
--- a/atk-adaptor/object.h
+++ b/atk-adaptor/object.h
@@ -46,7 +46,7 @@ void
 spi_object_append_null_reference (DBusMessageIter * iter);
 
 DBusMessage *
-spi_object_return_reference (DBusMessage * msg, AtkObject * obj, gboolean unref);
+spi_object_return_reference (DBusMessage * msg, AtkObject * obj);
 
 DBusMessage *
 spi_hyperlink_return_reference (DBusMessage * msg, AtkHyperlink * obj);



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