Re: request for g_nullify_pointer and a question about weak refs



Tim Janik <timj gtk org> writes:

> On 1 Aug 2001, Sven Neumann wrote:
> 
> > Hi,
> > 
> > can we please introduce something like gtk_widget_destroyed() to
> > GLib or GObject? Despite from being horribly bad named, 
> > gtk_widget_destroyed() is a very useful function for closures and
> > destroy_notfiers, but it should definitely live in GLib. I'd
> > suggest g_nullify_pointer() and I'd vote for marking 
> > gtk_widget_destroyed() as deprecated once we have a better named
> > function.
> 
> i think we discussed this earlier, at least partially.
> 
> owen basically argued in favour of keeping
> void gtk_widget_destroyed(gpointer ignored_arg, gpointer *nullify_location);
> since:
> 1) it's usefull to connect to a bunch of signals, without even needing
>    to use _swapped variants.
> 2) people know it already, and it probably has been deployed in a bunch of
>    third-party code.

Well, yes, I argued for 2) - there was no reason to deprecate something
that still worked fine.

But no, I didn't argue that we should keep it because it was the
best way of doing things.

What I argued was that rather than having a convenience handler,
we should add a facility to glib to do this. And submitted
a patch to do this (Subject: convenience functions)

In the discussion of how they should be named, I think:

 void g_object_add_weak_pointer    (GObject  *object,
                                    gpointer *location);
 void g_object_remove_weak_pointer (GObject  *object,
                                    gpointer *location);

Were preferred.

Regards,
                                        Owen




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