Hi, I hope this is the correct ML to ask something about glib. I'm creating a GIOChannel with g_io_channel_unix_new() and installing it as a source with g_io_add_watch(). Everything works, but I don't know if/how am I suppose to cleanup the things after the file descriptor closes.
In the GIOFunc callback I'm returning FALSE when I want to close the stream, and I presume this removes the reference initially set by g_io_add_watch(). In all code snippets I've found online, this is all what is done. But according to the docs, g_io_channel_unix_new() creates the channel with a reference count set to 1, so I guess we need a g_object_unref() somewhere. Would this sequence of calls be correct: - g_io_channel_unix_new() (ref 0->1) - g_io_add_watch() (ref 1->2) - g_object_unref() (ref 2->1) - ...callback is invoked some times ... - callback returns FALSE (ref 1->0) I'm just guessing that returning FALSE decrements the ref count. Anyone has a clear understanding of how the flow should be? TIA, Alberto -- http://www.mardy.it <-- Geek in un lingua international! _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list