David Nečas (Yeti) wrote:> On Thu, May 03, 2007 at 10:40:17PM +0200, ??ystein Johansen wrote:>> Aha, but how/where to I set the pointer to the finalize() function?> > In my_class_init() where you override all other methods.> See (almost) any Gtk+ widget for examples. Aha again! I guess I can free private members in the same method as well? static voidneural_net_finalize (GObject *object){ NeuralNet *nn; g_return_if_fail (IS_NEURAL_NET(object)); nn = NEURAL_NET(object); g_free(nn->priv->weight_h); g_free(nn->priv->weight_o); g_free(nn->priv->bias_h); g_free(nn->priv->bias_o); g_free(nn->priv->filename); g_free(nn->priv); g_message("This is the finalize method and I've freed the instancemembers!\n"); } static voidneural_net_class_init (NeuralNetClass *klass){ GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = neural_net_finalize; g_type_class_add_private (klass, sizeof (NeuralNetPrivate));} I think this looks ok, doesn't it? No, wait a minite.... What about theparent? This class has GObjectClass as parent, how do I call it's finalize? Thanks,-Øystein _______________________________________________gtk-list mailing listgtk-list@xxxxxxxxxxxxx://mail.gnome.org/mailman/listinfo/gtk-list