Re: [PATCH 5/5] core: Add a default root media in =?UTF-8?Q?notify=5Fchange=28=29?=




On Tue, 01 Feb 2011 13:49:39 +0100, "Juan A." Suárez Romero <jasuarez igalia com> wrote:
On Tue, 2011-02-01 at 12:41 +0000, Iago Toral wrote:
(...)

And who would free media if it was non null? I guess it is simpler and more consistent with the rest of the fw if all media objects provided by grilo plugins are owned by the client. Would make the code here easier
 as well.

That is why I had that code: the one creating the media was the media
owner and the one in charge of freeing it.

Thus if, media==NULL, grl_media_source_notify_change() would create a
media and free it; else, the plugin invoking notify_change() would free
it.

Now, why media is not transferred to client? The point here is that
actually client can connect several times to "content-changed" signal, invoking different callbacks. So, which callback will be the owner and
therefore be in charge of freeing it?

that's true.

In that case I'd still rework the code like this:

 if (!media) {
  media = grl_media_box_new ();
  free_media =TRUE;
 }
 grl_media_set_source (media,
                       grl_metadata_source_get_id (GRL_METADATA_SOURCE
 (source)));

...

if (free_media) {
  g_object_unref (media);
}

Iago


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