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



On Mon, 09 Aug 2010 17:42:19 +0200, "Juan A. Suarez Romero"
<jasuarez igalia com> wrote:
> 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).

I mean that we have two copies now, the original version in the keymap and the 
one we are copying ourselves, are we freeing both?

> 
> 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.

I think I am missing something, this is what I see in the patches (from brose_spec_unref):

+  if (g_atomic_int_dec_and_test (&bs->ref_count)) {
+    if (bs->source) {
+      g_object_unref (bs->source);
+    }
+    if (bs->container) {
+      g_object_unref (bs->container);
+    }
+    if (bs->keys) {
+      g_list_free (bs->keys);
+    }
+    g_free (bs);
 
I don't see where the keymap is freed :-?

Iago


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