EXC_BAD_ACCESS AppSink destroying callback
Created by: rozgo
Probably doing something very bad here. But getting errors upon killing pipeline.
EXC_BAD_ACCESS (code=1, address=0x1)
appsink.set_callbacks(gst_app::AppSinkCallbacks::new(
/* eos */
|_| {},
/* new_preroll */
|_| gst::FlowReturn::Ok,
/* new_samples */
move |appsink| {
// if this line is commented it wont crash
let p = appsink.pull_sample();
Callstack:
core::ptr::drop_in_place<gstreamer_app::app_sink::AppSinkCallbacks> (rust-lang/rust/src/libcore/ptr.rs:59)
core::ptr::drop_in_place<alloc::boxed::Box<gstreamer_app::app_sink::AppSinkCallbacks>> (rust-lang/rust/src/libcore/ptr.rs:59)
core::ptr::drop_in_place<alloc::boxed::Box<alloc::boxed::Box<gstreamer_app::app_sink::AppSinkCallbacks>>> (rust-lang/rust/src/libcore/ptr.rs:59)
gstreamer_app::app_sink::destroy_callbacks (gstreamer-rs-8719441e7bb90fbc/2f7ee30/gstreamer-app/src/app_sink.rs:82)
gst_app_sink_dispose (@1017d6b6f..1017d6c37:24)
g_object_unref (@10194dacf..10194dc8d:64)
gst_bin_remove_func (@10184436c..101844cc5:425)
gst_bin_remove (@101840eb2..10184113a:88)
gst_bin_dispose (@101841d0e..101841df5:40)
g_object_unref (@10194dacf..10194dc8d:64)
glib::object::{{impl}}::unref (glib-928cf7b282977403/a51dc67/src/object.rs:182)
glib::shared::{{impl}}::drop<gobject_sys::GObject,glib::object::MemoryManager> (glib-928cf7b282977403/a51dc67/src/shared.rs:276)
core::ptr::drop_in_place<glib::shared::Shared<gobject_sys::GObject, glib::object::MemoryManager>> (rust-lang/rust/src/libcore/ptr.rs:59)
core::ptr::drop_in_place<glib::object::ObjectRef> (rust-lang/rust/src/libcore/ptr.rs:59)
core::ptr::drop_in_place<gstreamer::auto::pipeline::Pipeline> (rust-lang/rust/src/libcore/ptr.rs:59)
mumblebot::gst::sink_loop (mumble-bot/src/gst.rs:156)
mumblebot::gst::sink_main::{{closure}} (mumble-bot/src/gst.rs:164)
std::sys_common::backtrace::__rust_begin_short_backtrace<closure,()> (rust-lang/rust/src/libstd/sys_common/backtrace.rs:134)
std::thread::{{impl}}::spawn::{{closure}}::{{closure}}<closure,()> (rust-lang/rust/src/libstd/thread/mod.rs:406)
Context:
pub fn sink_main(vox_out_tx: futures::sync::mpsc::Sender<Vec<u8>>) -> impl Fn() -> () {
let pipeline = sink_pipeline(vox_out_tx).unwrap();
let p = pipeline.clone();
thread::spawn(move || {
println!("start thread sink_loop");
sink_loop(pipeline);
println!("stop thread sink_loop");
});
// kill switch
move|| {
let ev = gst::Event::new_eos().build();
p.send_event(ev);
}
}