[Vala] How do I call functions which have a "ref" variable as one of their argument



Hi,

I've wanted to restart working on my vala branch of cheese. In the
meantime vala has received quite some changes. Therefore it does not
compile anymore. The main problem I have are "ref" variables. For
example with the text_extents method of Cairo

                TextExtents extents;
                text_extents ("hello", ref extents);

This does not compile because the compiler says.
"use of possibly unassigned local variable `extents' text_extents
("hello", ref extents);"

What should I do here or is it a bug in text_extents?

or also this code

                RawError dbus_error;
                
                dbus_error.init ();
                var hal = new Hal.Context ();

                if (hal == null)
                        throw new WebcamError.FAILED ("Error getting HAL context");

                if (!hal.set_dbus_connection (RawBus.get (BusType.SYSTEM, ref dbus_error)))
                        throw new WebcamError.FAILED ("Error setting dbus connection:
%s".printf (dbus_error.message));

complains about the fact that dbus_error is unassigned.

Any help will be highly appreciated

Thanks

Jaap



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