Re: GObject and Gtk+ Finalization



George <jirka 5z com> writes:

> 
> > The simplest way is to set object data with a destroy notifier. (Note
> > that "destroy notifier" here means it's called on finalize, as it is
> > in GtkObject now. Be careful because unlike with a callback connected
> > to the "destroy" method, with a finalize notifier it's pretty trivial
> > to create a cyclic refcount. "destroy" is more or less a solution to
> > the cyclic refcount problem, which GObject does not provide for you
> > since it's perhaps not a generic or typically appropriate solution for
> > non-GUI objects. Well, "destroy" is also in part a historical artifact
> > of the fact that widgets weren't always refcounted.)
> 
> I would say that this is a hack though (setting data with a destroy
> notifier).  This is a common enough thing that there should be a more
> "nonhackish" way to do it.
> 

I agree with George that the solution you have described is awfully
kludgey and non-obvious for something that's a very common task.

 - Maciej




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