mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-10-02 03:46:39 +02:00
check private instance data after initialization.
Tue Aug 19 05:21:04 2003 Tim Janik <timj@gtk.org> * testgobject.c (main): check private instance data after initialization. * gtype.c: for instances with private data, store the real class pointer in a bsearch array during class initialization. (g_type_instance_get_private): fetch the real class of an instance from the bsearch array if necessary.
This commit is contained in:
@@ -222,6 +222,7 @@ test_object_check_private_init (TestObject *tobject)
|
||||
|
||||
priv = TEST_OBJECT_GET_PRIVATE (tobject);
|
||||
|
||||
g_print ("private data during initialization: %u == %u\n", priv->dummy1, 54321);
|
||||
g_assert (priv->dummy1 == 54321);
|
||||
}
|
||||
static gboolean
|
||||
@@ -379,6 +380,7 @@ main (int argc,
|
||||
GType type;
|
||||
TestObject *sigarg;
|
||||
DerivedObject *dobject;
|
||||
TestObjectPrivate *priv;
|
||||
gchar *string = NULL;
|
||||
|
||||
g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) |
|
||||
@@ -412,6 +414,10 @@ main (int argc,
|
||||
g_print ("MAIN: call iface print-string on test and derived object:\n");
|
||||
iface_print_string (TEST_IFACE (sigarg), "iface-string-from-test-type");
|
||||
iface_print_string (TEST_IFACE (dobject), "iface-string-from-derived-type");
|
||||
|
||||
priv = TEST_OBJECT_GET_PRIVATE (dobject);
|
||||
g_print ("private data after initialization: %u == %u\n", priv->dummy1, 54321);
|
||||
g_assert (priv->dummy1 == 54321);
|
||||
|
||||
g_object_unref (sigarg);
|
||||
g_object_unref (dobject);
|
||||
|
Reference in New Issue
Block a user