Re: 2.x API and GDateTime
- From: "Juan A. Suarez Romero" <jasuarez igalia com>
- To: Bastien Nocera <hadess hadess net>
- Cc: grilo-list gnome org
- Subject: Re: 2.x API and GDateTime
- Date: Tue, 25 Dec 2012 17:06:20 +0100
On Mon, 2012-12-17 at 07:52 +0100, Bastien Nocera wrote:
> On Sun, 2012-12-16 at 17:07 +0100, Juan A. Suarez Romero wrote:
> > On Sun, 2012-12-16 at 15:25 +0100, Roland Peffer wrote:
> > > Thanks for the answer.
> > > I checked again:
> > >
> > > grl_media_set_creation_date (media); increases the reference counter.
> > >
> > > grl_media_get_creation_date(media) leaves reference counter untouched.
> > >
> > >
> > > For my understanding this is not correct.
> > > Either grl_media_get_creation_date should be marked with const ,
> >
> >
> > Probably it would make sense.
>
> It should just return a new reference. Anything else is broken.
Could you elaborate it a bit more? Why returning a non-increased
reference is broken?
>
> > But to avoid changing the API in this moment, I will fix the
> > documentation so it makes clearly that returned value shouldn't be
> > modified at all.
> >
> > > or better also should increase the ref counter on the GDateTime object.
> >
> > This option would make this function behave different than the other
> > grl_media_get_foo() functions.
> >
> > In these functions the returned type is sort of "const". The returned
> > data is just to be used as read-only mode, and shouldn't it be freed.
>
> None of those functions return something that's akin to an object,
> GDateTime is an object with reference counting, and the convention is to
> return a new reference.
But there are a lot of functions returning objects without refcount
increased: g_value_get_object(), gtk_builder_get_object(),
json_node_get_object(), ...
All of them has the "transfer none" annotation, which is basically what
I want in the get_creation_date() too.
J.A.
PS: I'm on holidays, so I'm not reading email very much
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]