Re: [Vala] var does not honor weak?



On Sun, 2008-09-07 at 06:16 -0700, Mihail Naydenov wrote:

Im pretty new to both glib/gobject and vala so I might be missing
something, 
but creating a weak reference is supposed not to create a new
reference to the object it points to.

On the other hand var is supposed to guess the type of the reference,
so one will not have to type it explicitly.
But when using var on functions, returning a weak reference the
ref_count is increased, which is not the case if the same if the that
expression is typed manually:

`var' only infers the object type from the expression on the right-hand
side of the variable declaration. weak/strong is not part of the object
type, it's part of the variable or return type. In other words, it's
intentional.

In most cases there won't be an issue when you use a strong reference
even if you could have used a weak reference, however, there are quite
some cases where the other way round would break your application.

Jürg




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