|
From: Chris F. <cd...@fo...> - 2010-06-25 19:21:19
|
On Fri, Jun 25, 2010 at 08:24:49PM +1200, Daniel Gollub wrote: > So if OSyncMember get freed the OSyncPluginConfig gets also freed if no other > function wants it shares on that object by increasing the ref-counts of this > pointer. > > Does this make more sense now? :) Yes, thanks. :-) My next question, which Graham has alluded to, is how do I tell which functions require an _unref() in the calling code, and which functions don't? So far, it seems like: - any _new() function requires an _unref() - any _set() function will make a copy, so the caller still owns the original data - any error requires an _unref() of the error object After that, any other _get()'able data does not need to be freed, such as getting names and strings and even config objects. I don't think I've seen an explicit rule like this, but it makes sense from the code I've seen. The main problem is that I usually have to read the library code before I'm sure. :-) > Thanks for finding this ... You're welcome! - Chris |