summaryrefslogtreecommitdiffstats
path: root/glib/dbus-gtype-specialized.c
diff options
context:
space:
mode:
authorRobert McQueen <robot101@debian.org>2006-01-27 15:40:36 +0000
committerRobert McQueen <robot101@debian.org>2006-01-27 15:40:36 +0000
commit8e00b10d134e4fb844cdc961e5c3230edf194b57 (patch)
tree916ef4ae22231cf4cd6d320fc23a97137ac2a2d6 /glib/dbus-gtype-specialized.c
parentce13b5dff7208beade01ac06235c263872201c80 (diff)
2006-01-27 Robert McQueen <robot101@debian.org>
* glib/dbus-gtype-specialized.[ch], glib/dbus-gvalue-utils.c: Patch by me and Rob Taylor to add a simple_free function to D-Bus map and collection types, which allows those types which can be freed with a GDestroyNotify (such as GHashTables and GArrays, but not GPtrArrays) to be stored as the values in hashtables. * test/glib/test-dbus-glib.c, test/glib/test-service-glib.{c,xml}: Patch by Rob Taylor to add nested dicts to the glib tests to check the above code works, and appears not to leak when called repeatedly.
Diffstat (limited to 'glib/dbus-gtype-specialized.c')
-rw-r--r--glib/dbus-gtype-specialized.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/glib/dbus-gtype-specialized.c b/glib/dbus-gtype-specialized.c
index ccf65eef..ad93a8c5 100644
--- a/glib/dbus-gtype-specialized.c
+++ b/glib/dbus-gtype-specialized.c
@@ -91,7 +91,15 @@ proxy_value_free (GValue *value)
data = lookup_specialization_data (type);
g_assert (data != NULL);
- data->klass->vtable->free_func (type, value->data[0].v_pointer);
+ if (data->klass->vtable->free_func)
+ {
+ data->klass->vtable->free_func (type, value->data[0].v_pointer);
+ }
+ else
+ {
+ g_assert (data->klass->vtable->simple_free_func != NULL);
+ data->klass->vtable->simple_free_func (value->data[0].v_pointer);
+ }
}
}
@@ -227,6 +235,29 @@ dbus_g_type_register_map (const char *name,
register_container (name, DBUS_G_SPECTYPE_MAP, (const DBusGTypeSpecializedVtable*) vtable);
}
+const DBusGTypeSpecializedMapVtable* dbus_g_type_map_peek_vtable (GType map_type)
+{
+ DBusGTypeSpecializedData *data;
+ g_return_val_if_fail (dbus_g_type_is_map(map_type), NULL);
+
+ data = lookup_specialization_data (map_type);
+ g_assert (data != NULL);
+
+ return (DBusGTypeSpecializedMapVtable *)(data->klass->vtable);
+}
+
+const DBusGTypeSpecializedCollectionVtable* dbus_g_type_collection_peek_vtable (GType collection_type)
+{
+ DBusGTypeSpecializedData *data;
+ g_return_val_if_fail (dbus_g_type_is_collection(collection_type), NULL);
+
+ data = lookup_specialization_data (collection_type);
+ g_assert (data != NULL);
+
+ return (DBusGTypeSpecializedCollectionVtable *)(data->klass->vtable);
+}
+
+
static GType
register_specialized_instance (const DBusGTypeSpecializedContainer *klass,
char *name,