MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Message-ID: <17186.51356.191985.124544 at karryall.dnsalias.org> Date: Sat, 10 Sep 2005 13:50:52 +0200 From: Olivier Andrieu To: romildo at uber.com.br Cc: Jacques Garrigue , lablgtk@math.nagoya-u.ac.jp Subject: Re: Help in C interface In-Reply-To: <20050908.105713.102767324.garrigue at math.nagoya-u.ac.jp> References: <20050907192141.GA7177 at malaquias> <17183.24114.533709.114006@karryall.dnsalias.org> <20050908.105713.102767324.garrigue@math.nagoya-u.ac.jp> Content-Transfer-Encoding: 8bit Jacques Garrigue [Thursday 8 September 2005] : > > From: Olivier Andrieu > > > You can use g_object_set_data_full() to tie your dynamically > > allocated arrays to the object. This function lets you register a > > finalizer function that will free the arrays when the GtkDatabox > > object is finalized. Somthg like this: > > Wouldn't it be simpler to register a callback on destroy? Since a > GtkDatabox inherit from GtkObject, it has a destroy signal. This > avoids adding a "key" parameter, whose role seems unclear here. Right. Even with for a plain GObject there is a better solution: g_object_add_weak_ref() « Weak references are used for notification when an object is finalized ». g_object_add_weak_ref (G_OBJECT (box), (GWeakNotify) g_free, vetx); -- Olivier