Re: [Vala] Invalid assignment from owned expression to unowned variable



Abderrahim,

1)  msg = (owned) msg;
    Results in "No reference to be transferred"

    As to why I am using "out" is because when I was changing the
"msg.response_headers" and the changes where not being reflected back
when I was finished using msg.

2)  public string get_session_id (unowned Soup.Message msg)
    Results in "error: syntax error, `new' modifier not allowed on
creation method"
    This tries to initialize the variable msg




On Fri, Apr 15, 2011 at 10:36 AM, Abderrahim Kitouni
<a kitouni gmail com> wrote:
Hello,

On Thu, Apr 14, 2011 at 6:45 PM, Joseph Montanez
<jmontanez gorilla3d com> wrote:
I got it, I needed

public void dostuff (out unowned Soup.Message msg)

and then I could do:
dostuff(out msg);


No you shouldn't. You probably need to transfer ownership as in:

public void dostuff (out unowned Soup.Message msg) {
       ...
       msg = (owned) ...;
}

btw, why using an out argument? If you need to return only one value,
it'd be easier to use a return value instead.

                في ج، 15-04-2011 عند 10:18 -0700 ، كتب Joseph Montanez:
Actually when I access anything from "msg", it just segment faults :(

https://gist.github.com/922060

What's this? Why do you think you need 'out' here? You should simply
remove the 'out' keyword (and 'unowned' as well, since it would be
unowned by default).


HTH,
Abderrahim





-- 
Joseph Montanez
Web Developer
Gorilla3D
Design, Develop, Deploy



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