Initialize node->data->instance.private_size here rather than in
authorOwen Taylor <otaylor@redhat.com>
Tue, 8 Jul 2003 18:59:04 +0000 (18:59 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Tue, 8 Jul 2003 18:59:04 +0000 (18:59 +0000)
Tue Jul  8 14:55:27 2003  Owen Taylor  <otaylor@redhat.com>

        * gtype.c (type_class_init_Wm): Initialize
        node->data->instance.private_size here rather than
        in type_data_make_W() since the class init for the parent
        class may have changed pnode->data->instance.private_size.
        (#116921, reported by Soeren Sandmann)

gobject/ChangeLog
gobject/gtype.c

index 3f7ee28944f4f42b0507f326b0f14adda9542312..a7fb859aab2a7070c73cb111d36b618ee1f2f234 100644 (file)
@@ -1,3 +1,11 @@
+Tue Jul  8 14:55:27 2003  Owen Taylor  <otaylor@redhat.com>
+
+       * gtype.c (type_class_init_Wm): Initialize
+       node->data->instance.private_size here rather than
+       in type_data_make_W() since the class init for the parent
+        class may have changed pnode->data->instance.private_size.
+       (#116921, reported by Soeren Sandmann)
+
 2003-06-18  Matthias Clasen  <maclas@gmx.de>
 
        * Makefile.am (man_MANS): Removed, these are now installed from
index 4388d137bd18340eaad347fa60a68f8b2c02bd5c..320897c44843014d87a11df71296f859fffcf6a0 100644 (file)
@@ -926,13 +926,10 @@ type_data_make_W (TypeNode              *node,
       data->instance.class_data = info->class_data;
       data->instance.class = NULL;
       data->instance.instance_size = info->instance_size;
-      if (NODE_PARENT_TYPE (node))
-       {
-         TypeNode *pnode = lookup_type_node_I (NODE_PARENT_TYPE (node));
-         data->instance.private_size = pnode->data->instance.private_size;
-       }
-      else
-       data->instance.private_size = 0;
+      /* We'll set the final value for data->instance.private size
+       * after the parent class has been initialized
+       */
+      data->instance.private_size = 0;
 #ifdef DISABLE_MEM_POOLS
       data->instance.n_preallocs = 0;
 #else  /* !DISABLE_MEM_POOLS */
@@ -1588,6 +1585,11 @@ type_class_init_Wm (TypeNode   *node,
       TypeNode *pnode = lookup_type_node_I (pclass->g_type);
       
       memcpy (class, pclass, pnode->data->class.class_size);
+      /* We need to initialize the private_size here rather than in
+       * type_data_make_W() since the class init for the parent
+       * class may have changed pnode->data->instance.private_size.
+       */
+      node->data->instance.private_size = pnode->data->instance.private_size;
     }
   class->g_type = NODE_TYPE (node);