Re: GIOChannel, how to free?



On Wednesday 04 April 2007 13:49, Iain * wrote:
On 4/4/07, Alberto Mardegan <mardy users sourceforge net> wrote:
ext Iain * wrote:
http://developer.gnome.org/doc/API/2.0/glib/glib-IO-Channels.html#g-io-
channel-unref

perhaps?

Sure. My question is, how many times (and when) do I have to call it?

Once when you've finished with it

In the context of his original question, that is not right.  His original 
question was whether the callback returning FALSE avoids the need for an 
explicit final call to g_io_channel_unref() to destroy the GIOChannel object, 
assuming that before the callback returns false it only has a reference count 
of 1.

The answer is yes, since g_io_unix_add_watch(), which is called for unix 
systems by g_io_create_watch() by the io_creat_watch() callback, calls 
g_source_new() with the finalize member of the GSourceFuncs object pointing 
to the g_io_unix_finalize() function, which in turn calls 
g_io_channel_unref() - in fact that is all g_io_unix_finalize() does.

I assume the windows equivalents do the same.

Chris




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]