Re: [Vala] Problem with Closure in Coroutine



On Sun, 2009-12-13 at 13:00 +0100, Michael 'Mickey' Lauer wrote:
Am Sonntag, den 13.12.2009, 11:01 +0100 schrieb Jürg Billeter:
On Sat, 2009-12-12 at 19:18 +0100, Michael 'Mickey' Lauer wrote:
The problem seems to be that the data for the closure
(_data_->_data2_)
gets unref'ed when the function ends; however Gst is calling the
callback later on and then the instance is 0x0. The C code for this
function is:

Can you check whether it works if you use add_watch_full() instead of
add_watch()?

Awesome, that does it! Should we then change add_watch like

-                public uint add_watch (Gst.BusFunc func);
+                public uint add_watch (owned Gst.BusFunc func);
?

No, this is not possible as the C function gst_bus_add_watch does not
have a GDestroyNotify parameter which is necessary to support owned
delegates. However, I've now fixed the binding to always use
gst_bus_add_watch_full to avoid such issues.

Jürg




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