gobject bug?
- From: tom <tom dbservice com>
- To: gtk-devel-list gnome org
- Subject: gobject bug?
- Date: Wed, 08 Jan 2003 16:25:19 +0100
i created a fundamental object 'foo':
GType
foo_get_type (void)
{
static GType type = 0;
static const GTypeFundamentalInfo finfo = {
G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE |
G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE
};
if (!type)
{
static const GTypeInfo info = {
sizeof (fooClass),
(GBaseInitFunc) foo_base_init,
(GBaseFinalizeFunc) foo_base_finalize,
(GClassInitFunc) foo_class_init,
(GClassFinalizeFunc) foo_class_finalize,
NULL,
sizeof (foo),
0,
(GInstanceInitFunc) foo_instance_init,
NULL
};
g_type_init ();
type = g_type_register_fundamental (g_type_fundamental_next (), "foo",
&info, &finfo, 0);
g_assert (G_TYPE_IS_FUNDAMENTAL (type));
}
return type;
}
foo *
foo_new ()
{
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, __FUNCTION__);
return (foo *) g_type_create_instance (FOO_TYPE);
}
void
foo_destroy (foo * f)
{
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, __FUNCTION__);
g_type_free_instance ((GTypeInstance *) f);
}
static void
foo_base_init (fooClass * g_class)
{g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, __FUNCTION__);}
static void
foo_base_finalize (fooClass * g_class)
{g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, __FUNCTION__);}
static void
foo_class_init (fooClass * g_class, gpointer class_data)
{g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, __FUNCTION__);}
static void
foo_class_finalize (fooClass * g_class, gpointer class_data)
{g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, __FUNCTION__);}
static void
foo_instance_init (foo * instance, fooClass * g_class)
{g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, __FUNCTION__);}
but if i do this:
main()
{
foo *f = foo_new();
foo_destroy(f);
sleep(2);
return 0;
}
i get:
(process:6270): foo-DEBUG: foo_new
(process:6270): foo-DEBUG: foo_base_init
(process:6270): foo-DEBUG: foo_class_init
(process:6270): foo-DEBUG: foo_instance_init
(process:6270): foo-DEBUG: foo_destroy
and thats all... why are the functions 'foo_class_finalize' and
'foo_base_finalize' not called ?
thanks
tom
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]