Re: [PATCH 11/15] core: Use constructors to create GrlMetadataSourceFooSpec



On Mon, 2010-08-09 at 11:40 +0200, Iago Toral Quiroga wrote:
> Are you sure that you have to copy this list here? Is this copy freed
> somewhere else? Notice this list is not provided by the user, thus, we
> do not have any need to make a copy of it in principle, there is no
> risk
> of it being freed by the client after invoking us. 

Yes, the list is freed when unreffing the spec (see patch #13).


Note also that the keymap is always destroyed after invoking callback
with remaining==0; ref() only affects the spec, not the keymap. So we
need to copy the list if we want to keep it in the spec.

Of course, another approach would be not to copy the list, and not free
it when freeing the keymap, but when freeing the spec. But I think it is
easier to understand the current approach when looking at the code.

Thus, you always see the the same pattern when creating a spec of any
kind: keylists are always copied.

	J.A.




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