Re: [Vala] Patch: libgee:get_weak_ref



A better alternative is to modify the signature of 'get' directly to
weak.

Bugzilla 516774 516773


On Wed, 2008-11-19 at 18:26 -0500, Yu Feng wrote:
Are there a bz entry for libgee? I wasn't able to find it.

When the collections in Gee are holding strong references, it is
difficult to obtain a weak reference to the elements in the container.

The situation is:

class Node {
      Gee.List<Node> childNodes;
      public Node? firstChild {
              get {
                      return childNodes.get(0);
////// panic! the signature of properties are weak!.
              }
      }

}
I was able to workaround by
      get {
              Node rt = childNodes.get(0);
              return rt;
      }
But this doesn't look intuitive and causes further troubles[difficult to
explain]. a better looking solution is
      get {
              return childNode.get_weak_ref(0);
      }

The attached patch adds get_weak_ref to libgee.

Regards,

Yu




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