Re: Unref-ing a dummy GtkWindow -> crash
- From: Ed Catmur <ed catmur co uk>
- To: gtk-list gnome org
- Subject: Re: Unref-ing a dummy GtkWindow -> crash
- Date: Sun, 09 Dec 2007 22:24:53 +0000
On Fri, 2007-12-07 at 23:49 +0100, ole nielsby pils org wrote:
> I'm trying implementing dynamic object creation for a language binding.
> First of all, I need to be able to simply create objects without specifying
> attributes, and free them.
>
> This seems this works for some types (GtkAction) but not for
> others (GtkWindow).
The difference is that GtkWindow (and GtkWidget, etc.) inherit from
GInitiallyUnowned. Initially-unowned objects are born with a reference
count of 0 and a "floating" reference that is sunk when they are added
to a container.
In your code you need to
g_object_ref_sink (x);
before unreffing it.
Ed
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]