A questiona about memory handling in Gobject based classes

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

 



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
class_finalize_function.

so the only place left seems to be GBaseInitFunc and
GBaseFinalizeFunc.

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.

Thanks
Friedrich
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux