[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [Vala] error on property.
- From: Sam Liddicott <sam liddicott com>
- To: Alexey Lubimov <avl l14 ru>
- Cc: vala-list gnome org
- Subject: Re: [Vala] error on property.
- Date: Wed, 20 Aug 2008 17:42:40 +0100
properties and property getters are all weak.
but you are also generating the string you return which is not weak.
if the actual string value returned doesn't change, you might want to
use a lazy create and have the object "own" the string and then you can
return a weak reference:
private string _fio;
public weak string get_fio() {
if (_fio == null) {
fio = "%s %C. %C".printf(l_name,f_name.get_char(),m_name.get_char());
}
return fio;
}
Sam
* Alexey Lubimov wrote, On 20/08/08 16:46:
> public class Info.PersonInfo {
> public string f_name;
> public string m_name;
> public string l_name;
> public string fio {get {return this.get_fio();}}
>
> public string get_fio() {
> return "%s %C. %C".printf(l_name,f_name.get_char(),m_name.get_char());
> }
> }
>
>
>
> PersonInfo.vala:12.7-12.28: error: Return value transfers ownership
> but method return type hasn't been declared to transfer ownership
>
> That's wrong?
> any tips?
>
>
> _______________________________________________
> Vala-list mailing list
> Vala-list gnome org
> http://mail.gnome.org/mailman/listinfo/vala-list
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]