GstPromise is a boxed type and needs to be passed to GValue accordingly

also handle nil unmarshalling
This commit is contained in:
RSWilli
2024-09-23 16:31:26 +02:00
parent b30ab7399c
commit 7bc995c4f5

View File

@@ -188,14 +188,18 @@ func (p *Promise) ToGValue() (*glib.Value, error) {
if err != nil {
return nil, err
}
val.SetInstance(unsafe.Pointer(p.Instance()))
val.SetBoxed(unsafe.Pointer(p.Instance()))
return val, nil
}
func marshalPromise(p unsafe.Pointer) (interface{}, error) {
c := C.g_value_get_object(toGValue(p))
c := C.g_value_get_boxed(toGValue(p))
obj := (*C.GstPromise)(unsafe.Pointer(c))
if obj == nil {
return nil, nil
}
prom := &Promise{
ptr: obj,
done: nil, // cannot be awaited if received from FFI