As it only takes a pointer, and not a pointer to a pointer (&ptr), there's no way for g_object_unref to set the original pointer variable to NULL, you'd have to nullify it yourself, either through g_pointer_nullify or just ptr = NULL. If you want you can wrap the two in a macro, but as far as I know, glib doesn't include anything of the sort:
#define G_OBJECT_UNREF_AND_NULLIFY(ptr) { \ g_object_unref(ptr); \ (ptr) = NULL; \ } On Thu, 18 Nov 2010 22:11:45 +0000 N James Bridge <ja...@xmas.demon.co.uk> wrote: > It seems that g_object_unref (ptr) doesn't set ptr to NULL when it frees > the allocated memory. Have I got something wrong here? Do I have to do > it explicitly? > > Thanks, James Bridge > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Nader Morshed <morshed.na...@gmail.com> _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list