[gjs] gi: don't try to directly allocate structs that we don't know the size of



commit 63fb30e21384021a5736921208b63781ec37c3de
Author: Dan Winship <danw gnome org>
Date:   Mon Jun 20 12:07:53 2011 -0400

    gi: don't try to directly allocate structs that we don't know the size of
    
    https://bugzilla.gnome.org/show_bug.cgi?id=652880

 gi/boxed.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gi/boxed.c b/gi/boxed.c
index 4e5ef72..11297e9 100644
--- a/gi/boxed.c
+++ b/gi/boxed.c
@@ -1144,6 +1144,10 @@ struct_is_simple(GIStructInfo *info)
     gboolean is_simple = TRUE;
     int i;
 
+    /* If it's opaque, it's not simple */
+    if (n_fields == 0)
+        return FALSE;
+
     for (i = 0; i < n_fields && is_simple; i++) {
         GIFieldInfo *field_info = g_struct_info_get_field(info, i);
         GITypeInfo *type_info = g_field_info_get_type(field_info);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]