call the base classes' object_init_func for derived objects with the

Sun Jul 12 05:59:26 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtktypeutils.c (gtk_type_new): call the base classes'
        object_init_func for derived objects with the object's ->klass field
        still pointing to the corresponding base class, otherwise overridden
        class functions could get called with partly-initialized objects.
        (change from Tero Pulkkinen <terop@modeemi.cs.tut.fi>).
This commit is contained in:
Tim Janik 1998-07-12 04:13:02 +00:00 committed by Tim Janik
parent ab7cb5019e
commit 34b7b5d74e
8 changed files with 67 additions and 3 deletions

View File

@ -1,3 +1,11 @@
Sun Jul 12 05:59:26 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): call the base classes'
object_init_func for derived objects with the object's ->klass field
still pointing to the corresponding base class, otherwise overridden
class functions could get called with partly-initialized objects.
(change from Tero Pulkkinen <terop@modeemi.cs.tut.fi>).
Sun Jul 12 02:47:35 1998 Tim Janik <timj@gtk.org>
* gtk/gtkobject.h:

View File

@ -1,3 +1,11 @@
Sun Jul 12 05:59:26 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): call the base classes'
object_init_func for derived objects with the object's ->klass field
still pointing to the corresponding base class, otherwise overridden
class functions could get called with partly-initialized objects.
(change from Tero Pulkkinen <terop@modeemi.cs.tut.fi>).
Sun Jul 12 02:47:35 1998 Tim Janik <timj@gtk.org>
* gtk/gtkobject.h:

View File

@ -1,3 +1,11 @@
Sun Jul 12 05:59:26 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): call the base classes'
object_init_func for derived objects with the object's ->klass field
still pointing to the corresponding base class, otherwise overridden
class functions could get called with partly-initialized objects.
(change from Tero Pulkkinen <terop@modeemi.cs.tut.fi>).
Sun Jul 12 02:47:35 1998 Tim Janik <timj@gtk.org>
* gtk/gtkobject.h:

View File

@ -1,3 +1,11 @@
Sun Jul 12 05:59:26 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): call the base classes'
object_init_func for derived objects with the object's ->klass field
still pointing to the corresponding base class, otherwise overridden
class functions could get called with partly-initialized objects.
(change from Tero Pulkkinen <terop@modeemi.cs.tut.fi>).
Sun Jul 12 02:47:35 1998 Tim Janik <timj@gtk.org>
* gtk/gtkobject.h:

View File

@ -1,3 +1,11 @@
Sun Jul 12 05:59:26 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): call the base classes'
object_init_func for derived objects with the object's ->klass field
still pointing to the corresponding base class, otherwise overridden
class functions could get called with partly-initialized objects.
(change from Tero Pulkkinen <terop@modeemi.cs.tut.fi>).
Sun Jul 12 02:47:35 1998 Tim Janik <timj@gtk.org>
* gtk/gtkobject.h:

View File

@ -1,3 +1,11 @@
Sun Jul 12 05:59:26 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): call the base classes'
object_init_func for derived objects with the object's ->klass field
still pointing to the corresponding base class, otherwise overridden
class functions could get called with partly-initialized objects.
(change from Tero Pulkkinen <terop@modeemi.cs.tut.fi>).
Sun Jul 12 02:47:35 1998 Tim Janik <timj@gtk.org>
* gtk/gtkobject.h:

View File

@ -1,3 +1,11 @@
Sun Jul 12 05:59:26 1998 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.c (gtk_type_new): call the base classes'
object_init_func for derived objects with the object's ->klass field
still pointing to the corresponding base class, otherwise overridden
class functions could get called with partly-initialized objects.
(change from Tero Pulkkinen <terop@modeemi.cs.tut.fi>).
Sun Jul 12 02:47:35 1998 Tim Janik <timj@gtk.org>
* gtk/gtkobject.h:

View File

@ -339,18 +339,26 @@ gtk_type_new (GtkType type)
}
else
object = g_malloc0 (node->type_info.object_size);
object->klass = klass;
/* we need to call the base classes' object_init_func for derived
* objects with the object's ->klass field still pointing to the
* corresponding base class, otherwise overridden class functions
* could get called with partly-initialized objects.
*/
for (i = node->n_supers; i > 0; i--)
{
GtkTypeNode *pnode;
LOOKUP_TYPE_NODE (pnode, node->supers[i]);
if (pnode->type_info.object_init_func)
(* pnode->type_info.object_init_func) (object);
{
object->klass = pnode->klass;
pnode->type_info.object_init_func (object);
}
}
object->klass = klass;
if (node->type_info.object_init_func)
(* node->type_info.object_init_func) (object);
node->type_info.object_init_func (object);
return object;
}