Re: [Vala] Another problem since Vala 0.13.2 - Methods sending blocks to be filled



Am Mittwoch, den 19.10.2011, 22:12 +0200 schrieb Jan-Jaap van der Geer:
So get_info() is called with a copy of the parameter after which
the original is used to read the values. So it isn't reading the
results of get_info at all.

I could get this to work by changing the vapi to:

  public static void GetInfo (Foo* block);

and calling it by:

  GetInfo(&foo);
  
but:
a) this means lots of changes in my code
b) it seems a step backwards to start using pointers where this
previously was not needed.

Is there a better way?

Vala now copies structs before passing them to methods.
Use the out and ref modifiers if you want methods to modify them:

void get_info(out Foo block);
get_info(out foo);

You'll still have to change your code though.

Regards, Sergej.




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