A questiona about memory handling in Gobject based classes

Ok I read the docs up and down but still am confused.
Assume I have something like  this

struct FooObject { 
       GObject parent;

struct FooClas {
    GObjectClass parentClass;
    /* but then also */
    some other_struct *struct_pointer;

Now I have to allocate the struct_pointer dynamically. 

As I understand this could be done in the _class_init function or
base_class_init function

If I put it into the FooClass_class_init function then I expected 
to have to write  FooClass_finalize function also but 
if one calls g_type_register_static one can not have a

so the only place left seems to be GBaseInitFunc and

I do not understand when this functins get called. 

E.g.  what happens if I just have one FooObject and 
I call g_object_unref on it. The reference counts goes down to 0, so
I'd think the GBaseFinalizeFunction should be called,  but that does
not happen. At least a breakpoint isn't hit. 

In the end my question is how is a ObjectClass structure destroyed?

Do I have to write special dispose function? 

Hints for a better understanding of this memory handling stuff would
be very appreciated.


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