Hi all,

I have some questions related to ownership.

If I write something like this:

              public string test { get { return xxx(); } }

              private unowned string xxx() {
                string a = "XXX";
                return a;
              }

I end with error:

error: Local variable with strong reference used as return value and
method return type has not been declared to transfer ownership


What is correct approach to fix this?

a)

              public string test { get { return xxx(); } }

              private unowned string xxx() {
                weak string a = "XXX";
                return a;
              }


b)

              public string test { owned get { return xxx(); } }

              private string xxx() {
                string a = "XXX";
                return a;
              }


??

Could anyone describe what happens with memory handling in both cases
under the hood?

Thank you

Marcin
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to