[Vala] reference problem
- From: picca <picca synchrotron-soleil Fr>
- To: vala <vala-list gnome org>
- Subject: [Vala] reference problem
- Date: Tue, 5 Aug 2008 14:00:59 +0200
Hello
Here the vala code then I will explain my problem
public class Holder {
weak List<Axis> axes;
Holder(ref List<Axis> axes) {
this.axes = axes
}
...other method modifing the this.axes...
}
public class Geometry { // the real owner of the list
List<Axis> axes;
List<Holder> holders;
public add_holder() {
this.holders.append(new Holder(ref this.axes));
}
}
So I create a geometry with one holder then I use the holder method to
modify the axes list owned by the geometry.
but the C code show that in the holder class
struct _Holder {
Glist *axes;
};
holder_new(Holder *self, GList **axes)
{
(*self).axes = (*axes);
}
So instead of modifying the Geometry list it use a new one created in
the holder.
The right C code would have been
struct _Holder {
GList **axes;
};
holder_new(Holder *self, GList **axes)
{
(*self).axes = axes;
}
So is it a bug ?
Cheers
Frederic
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]