cleanup
[platform/upstream/glib.git] / gio / gdbusinterface.c
index 7384149..5c1b355 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.
  *
  * Author: David Zeuthen <davidz@redhat.com>
  */
@@ -24,7 +22,6 @@
 
 #include "gdbusobject.h"
 #include "gdbusinterface.h"
-#include "gio-marshal.h"
 
 #include "glibintl.h"
 
@@ -34,8 +31,8 @@
  * @include: gio/gio.h
  *
  * The #GDBusInterface type is the base type for D-Bus interfaces both
- * on the service side (see #GDBusInterfaceStub) and client side (see
- * #GDBusProxy).
+ * on the service side (see #GDBusInterfaceSkeleton) and client side
+ * (see #GDBusProxy).
  */
 
 typedef GDBusInterfaceIface GDBusInterfaceInterface;
@@ -67,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
  */
@@ -85,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.
  *