Comment 33 for bug 948788

Revision history for this message
In , Trevor Saunders (trev-saunders) wrote :

(In reply to alexander :surkov from comment #21)
> (In reply to Ginn Chen from comment #20)
>
> > > > We need to copy the string to gchar* anyway.
> > >
> > > yep, just copy the string every time when we were asked. Doesn't sound good?
> >
> > Actually it's not possible.
> > atk_object_get_name() returns const gchar*, caller will not free the return
> > value.
> > We have to keep it somewhere in AtkObject, otherwise we leak.
>
> I see
>
> So if provide getName/setName implementation that will use accessible->name
> to store a value then would it be acceptable solution?

or we could do what we do for a bunch of other atk methods reutrning const gchar* nd use nsAccessibleWrap::ReturnString() which keeps a static nsCString and returns a pointer into its buffer, and so requires caller of atk method to copy returned string before calling another atk function, which I think its very likely the bridge will always do.