Closed devbrom closed 1 year ago
You don't need to call Unref
explicitly in go-gst because go-glib implements to do it when finalizing it's resource.
Refer to the following code snippet for your understanding.
// FromGstPipelineUnsafeFull wraps the given pipeline pointer.
func FromGstPipelineUnsafeFull(pipeline unsafe.Pointer) *Pipeline {
return &Pipeline{Bin: &Bin{&Element{wrapObject(glib.TransferFull(pipeline))}}}
}
// TransferFull wraps a unsafe.Pointer as a glib.Object, taking ownership of it.
// it does not increase the ref count on the object. A finalizer is placed on the object
// to clear the transfered ref.
func TransferFull(ptr unsafe.Pointer) *Object {
obj := newObject(ToGObject(ptr))
runtime.SetFinalizer(obj, (*Object).Unref)
return obj
}
BRs, bruc2kim
@devbrom move this issue to https://github.com/go-gst/go-gst (where future development of the bindings will take place) if you think it is necessary.
Although in short: No don't call Unref()
it is done for you when the variable goes out of scope (via a finalizer). The bindings are aiming for a more golang like development experience.
OK, understood. Thanks for your answers. Issue is closed.
At the first, thanks for very useful GStreamer binding for golang.
In my case, I must create and delete gst pipelines in runtime. According to the GStreamer documentation, I must call gst_object_unref for unnecessary pipelines for freeing resources.
When I call pipeline.Unref(), I get following error:
GLib-GObject-CRITICAL **: 11:54:51.773: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
Do you have any ideas how it can be resolved?
Thanks