[gobject-introspection/ebassi/property-annotation: 2/19] Property accessors work for interfaces and objects
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/ebassi/property-annotation: 2/19] Property accessors work for interfaces and objects
- Date: Wed, 28 Jul 2021 15:32:02 +0000 (UTC)
commit a36a68e3caeadf6fb66aba763d925bfe06339808
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Jun 16 19:15:05 2021 +0100
Property accessors work for interfaces and objects
We need to check the container type before trying to obtain a
GIPropertyInfo for GIFunctionInfos that have a SETTER or a GETTER flag
set.
girepository/gifunctioninfo.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/girepository/gifunctioninfo.c b/girepository/gifunctioninfo.c
index 366850d5..b042b4e1 100644
--- a/girepository/gifunctioninfo.c
+++ b/girepository/gifunctioninfo.c
@@ -165,18 +165,30 @@ g_function_info_get_flags (GIFunctionInfo *info)
GIPropertyInfo *
g_function_info_get_property (GIFunctionInfo *info)
{
- GIRealInfo *rinfo;
+ GIRealInfo *rinfo, *container_rinfo;
FunctionBlob *blob;
- GIInterfaceInfo *container;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_FUNCTION_INFO (info), NULL);
rinfo = (GIRealInfo *)info;
blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset];
- container = (GIInterfaceInfo *)rinfo->container;
+ container_rinfo = (GIRealInfo *)rinfo->container;
+
+ if (container_rinfo->type == GI_INFO_TYPE_INTERFACE)
+ {
+ GIInterfaceInfo *container = (GIInterfaceInfo *)rinfo->container;
- return g_interface_info_get_property (container, blob->index);
+ return g_interface_info_get_property (container, blob->index);
+ }
+ else if (container_rinfo->type == GI_INFO_TYPE_OBJECT)
+ {
+ GIObjectInfo *container = (GIObjectInfo *)rinfo->container;
+
+ return g_object_info_get_property (container, blob->index);
+ }
+ else
+ return NULL;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]