Re: GIOChannel close vs. unref



Ron Steinke <rsteinke w-link net> writes:

> 	Is there some reason that g_io_channel_close and
> g_io_channel_unref are completely unrelated (i.e. unref doesn't call
> close on the final unref)?

While the current behavior seem a little confusing, always
closing on unref() could definitely have bad side effects -
would you expect:

 id = gdk_input_add_full (fd, ...);
 gdk_input_remove (id);

To close the file descriptor? 

Since it is possible (and currrently required) to create a
channel from an existing stream, freeing the channel shouldn't
free the stream.

Generally, mixing up memory management with actions such as closing 
a stream is a bad idea, though more of an argument could be made
for it if the underlying stream was created along with the 
GIOChannel with g_io_channel_new_from_file().

Regards,
                                        Owen




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