Hi.

> That did help (I think I still have an unrelated leak). I think a few
> things could be made more clear in the docs (I'm not 100% sure I'm correct
> either):

I must agree with you here. Docs are a bit scarce on this topic. But ...

> -A newly created source (from g_idle_source_new() ) has a reference count
> of 1 not 0.
>
> -g_source_attach() increases the reference count by 1
>
> -returning FALSE in a source callback function detaches the source from
> the source's attached main context, and decreases the reference count by 1
>
> -Once a source has been detached by source callback function returning
> FALSE, it can not be reattached g_source_attach(). An assertion error is
> thrown. You can however, decrease the source's reference count down to 0 so
> it will free itself, then create a fresh source.

You got it exactly right. I would only add that you decrease reference
count right after attaching it to context (like Colomban already
suggested). This way memory used by source will be freed when detached
from context.


All that being said, maybe you could "cook up" a patch for API docs
with this info? I'm sure people would find it useful.

Tadej

-- 
Tadej Borovšak
tadeboro.blogspot.com
tadeb...@gmail.com
tadej.borov...@gmail.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to