Re: weak_pointer_location parameter to g_object_add_weak_pointer
- From: Darin Adler <darin bentspoon com>
- To: Owen Taylor <otaylor redhat com>
- Cc: Gtk Developers <gtk-devel-list gnome org>
- Subject: Re: weak_pointer_location parameter to g_object_add_weak_pointer
- Date: Wed, 06 Feb 2002 12:38:18 -0800
On 2/6/02 12:21 PM, "Owen Taylor" <otaylor redhat com> wrote:
> This was discussed at some length:
I should have participated more in the debate. I think I have a better
design. Here's the version I'll put in eel:
eel_add_weak_pointer (gpointer weak_pointer_location);
eel_remove_weak_pointer (gpointer weak_pointer_location);
These versions get the object pointer from the location. This check:
g_return_if_fail (G_IS_OBJECT (* (GObject **) weak_pointer_location));
will almost certainly fire if someone passes in a GObject * by mistake.
I'll also make eel_remove_weak_pointer be a no-op if the pointer is already
NULLed out, rather than requiring the caller to check, since that's the
common case.
Unlike g_add_weak_pointer, this doesn't work if the location you want to
NULL isn't an object pointer. But I don't mind losing that tiny feature of
g_add_weak_pointer, since I can always use g_object_weak_ref instead.
-- Darin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]