Re: [gnome-db]GdaConnectionPoolClass parent class



On 28 May 2001 16:19:53 -0400, Ian D . Stewart wrote:
> 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)
so, this function, in the GTK version, what would it do? I don't
understand what you mean with it very well

> 2) gda_object_free(obj), which unreferences the object, and
yes, as I said before, please mark any class that does not do this.

> 3) gda_object_delete(obj), which  deletes the object itself
> 
so, this would be the _destroy equivalent? if so, please call it
destroy, to keep up with GTK/Glib naming

> Does this sound about right?
> 
yes, sounds good

cheers
 
--
Rodrigo Moya <rodrigo gnome-db org> <rodrigo ximian com>
http://www.gnome-db.org/





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