[gjs] Bug 586665: Fix seg fault when attempting to free callback type.
- From: C. Scott Ananian <cananian src gnome org>
- To: svn-commits-list gnome org
- Subject: [gjs] Bug 586665: Fix seg fault when attempting to free callback type.
- Date: Mon, 22 Jun 2009 14:29:51 -0400 (EDT)
commit 1f19b470cb5c13d7280b34636be4eeb016f704b1
Author: C. Scott Ananian <cscott litl com>
Date: Fri Jun 5 18:29:25 2009 -0400
Bug 586665: Fix seg fault when attempting to free callback type.
gi/arg.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/gi/arg.c b/gi/arg.c
index a966197..008784d 100644
--- a/gi/arg.c
+++ b/gi/arg.c
@@ -154,13 +154,39 @@ type_needs_release (GITypeInfo *type_info,
return TRUE;
case GI_TYPE_TAG_INTERFACE: {
GIBaseInfo* interface_info;
+ GIInfoType interface_type;
GType gtype;
gboolean needs_release;
interface_info = g_type_info_get_interface(type_info);
g_assert(interface_info != NULL);
- gtype = g_registered_type_info_get_g_type((GIRegisteredTypeInfo*)interface_info);
+ interface_type = g_base_info_get_type(interface_info);
+
+ switch(interface_type) {
+
+ case GI_INFO_TYPE_STRUCT:
+ case GI_INFO_TYPE_ENUM:
+ case GI_INFO_TYPE_OBJECT:
+ case GI_INFO_TYPE_INTERFACE:
+ case GI_INFO_TYPE_UNION:
+ case GI_INFO_TYPE_BOXED:
+ /* These are subtypes of GIRegisteredTypeInfo for which the
+ * cast is safe */
+ gtype = g_registered_type_info_get_g_type
+ ((GIRegisteredTypeInfo*)interface_info);
+ break;
+
+ case GI_INFO_TYPE_VALUE:
+ /* Special case for GValues */
+ gtype = G_TYPE_VALUE;
+ break;
+
+ default:
+ /* Everything else */
+ gtype = G_TYPE_NONE;
+ break;
+ }
if (g_type_is_a(gtype, G_TYPE_CLOSURE) || g_type_is_a(gtype, G_TYPE_VALUE))
needs_release = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]