[gjs/wip/gcampax/700643-allow-creating-custom-tree-models: 360/361] boxed: mark structs with gpointer fields as simple
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/gcampax/700643-allow-creating-custom-tree-models: 360/361] boxed: mark structs with gpointer fields as simple
- Date: Sun, 4 Nov 2018 02:59:38 +0000 (UTC)
commit c0cc33f4051f982eaf2dbab89751bdc5f471a0d1
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun May 19 18:39:06 2013 +0200
boxed: mark structs with gpointer fields as simple
Even if we cannot set the field, it's pretty safe to initialize
it to NULL, and then you can use the rest of the structure.
This enables construction of Gtk.TreeIter, even if limited to
stamp.
https://bugzilla.gnome.org/show_bug.cgi?id=700643
gi/boxed.cpp | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index bb05e0c8..9fc98d8c 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -950,7 +950,8 @@ type_can_be_allocated_directly(GITypeInfo *type_info)
g_base_info_unref((GIBaseInfo*)param_info);
} else {
- is_simple = false;
+ if (g_type_info_get_tag(type_info) != GI_TYPE_TAG_VOID)
+ is_simple = false;
}
} else {
switch (g_type_info_get_tag(type_info)) {
@@ -995,6 +996,16 @@ type_can_be_allocated_directly(GITypeInfo *type_info)
g_base_info_unref(interface);
break;
}
+ case GI_TYPE_TAG_GTYPE:
+ case GI_TYPE_TAG_ERROR:
+ case GI_TYPE_TAG_UTF8:
+ case GI_TYPE_TAG_FILENAME:
+ case GI_TYPE_TAG_ARRAY:
+ case GI_TYPE_TAG_GLIST:
+ case GI_TYPE_TAG_GSLIST:
+ case GI_TYPE_TAG_GHASH:
+ is_simple = false;
+ break;
case GI_TYPE_TAG_BOOLEAN:
case GI_TYPE_TAG_INT8:
case GI_TYPE_TAG_UINT8:
@@ -1008,14 +1019,6 @@ type_can_be_allocated_directly(GITypeInfo *type_info)
case GI_TYPE_TAG_DOUBLE:
case GI_TYPE_TAG_UNICHAR:
case GI_TYPE_TAG_VOID:
- case GI_TYPE_TAG_GTYPE:
- case GI_TYPE_TAG_ERROR:
- case GI_TYPE_TAG_UTF8:
- case GI_TYPE_TAG_FILENAME:
- case GI_TYPE_TAG_ARRAY:
- case GI_TYPE_TAG_GLIST:
- case GI_TYPE_TAG_GSLIST:
- case GI_TYPE_TAG_GHASH:
default:
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]