X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgdbusinterface.c;h=5c1b3552c74997539619d54ddfe90d1dc290057d;hb=2e5bd8cf47f9e1559ccc44823a2f321b8ff8c1ea;hp=436ab3aec6cb51da79ae4477901cd1c9b32f3880;hpb=d85b722734a6fcfe94032f6113de9e5c190fd7c3;p=platform%2Fupstream%2Fglib.git diff --git a/gio/gdbusinterface.c b/gio/gdbusinterface.c index 436ab3a..5c1b355 100644 --- a/gio/gdbusinterface.c +++ b/gio/gdbusinterface.c @@ -13,9 +13,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. + * Public License along with this library; if not, see . * * Author: David Zeuthen */ @@ -66,13 +64,17 @@ g_dbus_interface_get_info (GDBusInterface *interface_) } /** - * g_dbus_interface_get_object: - * @interface_: An exported D-Bus interface. + * g_dbus_interface_get_object: (skip) + * @interface_: An exported D-Bus interface * * Gets the #GDBusObject that @interface_ belongs to, if any. * + * It is not safe to use the returned object if @interface_ or + * the returned object is being used from other threads. See + * g_dbus_interface_dup_object() for a thread-safe alternative. + * * Returns: (transfer none): A #GDBusObject or %NULL. The returned - * reference belongs to @interface_ and should not be freed. + * reference belongs to @interface_ and should not be freed. * * Since: 2.30 */ @@ -84,9 +86,42 @@ g_dbus_interface_get_object (GDBusInterface *interface_) } /** + * g_dbus_interface_dup_object: + * @interface_: An exported D-Bus interface. + * + * Gets the #GDBusObject that @interface_ belongs to, if any. + * + * Returns: (transfer full): A #GDBusObject or %NULL. The returned + * reference should be freed with g_object_unref(). + * + * Since: 2.32 + * + * Rename to: g_dbus_interface_get_object + */ +GDBusObject * +g_dbus_interface_dup_object (GDBusInterface *interface_) +{ + GDBusObject *ret; + g_return_val_if_fail (G_IS_DBUS_INTERFACE (interface_), NULL); + if (G_LIKELY (G_DBUS_INTERFACE_GET_IFACE (interface_)->dup_object != NULL)) + { + ret = G_DBUS_INTERFACE_GET_IFACE (interface_)->dup_object (interface_); + } + else + { + g_warning ("No dup_object() vfunc on type %s - using get_object() in a way that is not thread-safe.", + g_type_name_from_instance ((GTypeInstance *) interface_)); + ret = G_DBUS_INTERFACE_GET_IFACE (interface_)->get_object (interface_); + if (ret != NULL) + g_object_ref (ret); + } + return ret; +} + +/** * g_dbus_interface_set_object: * @interface_: An exported D-Bus interface. - * @object: A #GDBusObject or %NULL. + * @object: (allow-none): A #GDBusObject or %NULL. * * Sets the #GDBusObject for @interface_ to @object. *