Re: newbie question about g_object unref()
- From: Jannis Pohlmann <jannis xfce org>
- To: gtk-app-devel-list gnome org
- Subject: Re: newbie question about g_object unref()
- Date: Fri, 19 Nov 2010 01:35:45 +0100
On Thu, 18 Nov 2010 22:11:45 +0000
N James Bridge <james 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?
You can do it explicitely by using
g_object_add_weak_pointer (your_object, (gpointer) &your_object)
which sets your_object to NULL when it is destroyed. See
http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-add-weak-pointer
for more information. Note that this will only work for the variable
your_object. For other pointers to the object you'd have to do the same.
- Jannis
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]