Thread (8 messages) flat view 8 messages, 3 authors, 2011-06-29

Re: [PATCH BlueZ 1/6] Make use of g_slist_free_full when elements are dynamically-allocated

From: Johan Hedberg <hidden>
Date: 2011-06-29 20:18:33

Hi Lucas,

On Wed, Jun 29, 2011, Lucas De Marchi wrote:
Another thing that I think it'd be nice to use is
g_io_channel_set_close_on_unref() instead of unref() + shutdown() in
several places. What do you think?
You need to be careful with that since those two methods are not
identical: unref() + shutdown() will close the link immediately, whereas
close_on_unref() + unref() will not do anything (except the unref) if
there are any other references around. E.g. all IO callbacks own a
reference to the GIOChannel so doing a simple unref() on the GIOChannel
elsewhere will not actually close the link even if close_on_unref is
TRUE.

There are several places which expect the IO callback to check for
G_IO_NVAL and return FALSE if set (thereby removing the IO callback and
its GIOChannel reference). The only way you'd be able to convert such
cases is to change the unref() + shutdown() to a unref() +
g_source_remove(). However, this would eliminate most/some of the
simplification gain you're trying to accomplish.

Johan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help