Re: GIOChannel, how to free?



On 4/4/07, Chris Vine <chris cvine freeserve co uk> wrote:

> > 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.

Well, yes, if you've already dropped the reference count so that its
only depending on the watch to live then the watch will clean it up.
But that practice would scare me as its non-deterministic as to when
the GIOChannel will be destroyed.

Common practise would be to keep a reference to the IOChannel and drop
it once you've finished with it, which means you know better when its
been destroyed.

iain



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