Re: [Vala] Problem with closure values reference count



Hello,

2010/11/15 Moritz Bitsch <moritzbitsch googlemail com>:
Hi Everyone,

I found some strange errors related to closures.
The following code triggers it (tested with every vala version form
0.9.8 trough 0.11.2):
[...]
This short program prints "(null)" instead of "bug me".
It seems to me that closures don't do any refcounting for their BlockData.

Is this intended or a bug?
Both :-)

If the delegate parameter isn't "owned" (i.e. doesn't have a
GDestroyNotify parameter in the C code), there is no way for valac to
know when to free the data, so it frees it as soon as it goes out of
scope.

Actually, many of the functions having this problem have a common
property : they are called only once (This is the (scope async)
annotation of gobject-introspection), so I guess something like this
could be done in valac.

Maybe this is worth a bug report?

HTH,
Abderrahim



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