Re: [gnome-db]GdaConnectionPoolClass parent class



On Mon, May 28, 2001 at 09:18:42PM +0200, Reinhard Mueller wrote:
> Ian D . Stewart wrote:
> 
> > Ok, as some of you know, I've been working on cleaning up the handling of
> > GObject v. GtkObject in libgda.  Right now I'm looking at
> > gda-connection-pool.h.  Specifically, I'm looking at the structure of
> > GdaConnectionPoolClass, and I've come across the following code:
> > 
> > #ifdef HAVE_GOBJECT
> > 	GObjectClass   parent_class;
> > 	GObjectClass   *parent;
> > #else
> > 	GtkObjectClass parent_class;
> > #endif
> > 
> > I'm assuming the duplication of parent and parent_class is an error.  If not,
> > and there is some reasoning behind this, please let me know.
> > 
> > For now, I intend to replace the above code with:
> > 
> > 	GdaObjectClass parent_class;
> 
> There was a reason for this.
> GObjectClass parent_class; is to incorporate all fields of the parent class.
> GObjectClass *parent; is a pointer to the instance of the class object 
> of the parent class. This is used so that the "inherited" finalize 
> method can be called from this class's finalize method.
> Other objects don't have this because they have no own finalize method.
> I am not 100% sure if this is the "right" method to do it. Members of 
> the gtk list proposed creating a global variable, which is a thing i 
> don't like (i don't like global variables at all).
> 
> Whatever you do, please try to be clean with destroying/finalizing, as 
> memory holes will make libgda unusable for production systems.

Ok.  Just to make sure we are all in the same page, object cleanup goes
something like this:

1) gda_object_class_finalize(klazz), which frees any resources not directly 
associated with the object (shutting down database collections, etc), and then
calls gda_object_class_finalize(klazz->parent)
2) gda_object_free(obj), which unreferences the object, and
3) gda_object_delete(obj), which  deletes the object itself

Does this sound about right?


Regards,
Ian




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