forked from mirrors/gstreamer-rs
gstreamer/pad: Use the correct type for destroying the pad task closure data
It's a Box<RefCell<_>> and not a plain Box<_> like for the other pad functions, and doing this wrong causes crashes at runtime.
This commit is contained in:
parent
23a776ea63
commit
631eee13da
1 changed files with 5 additions and 1 deletions
|
@ -704,7 +704,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
Some(trampoline_pad_task::<F>),
|
Some(trampoline_pad_task::<F>),
|
||||||
into_raw_pad_task(func),
|
into_raw_pad_task(func),
|
||||||
Some(destroy_closure::<F>),
|
Some(destroy_closure_pad_task::<F>),
|
||||||
),
|
),
|
||||||
"Failed to start pad task",
|
"Failed to start pad task",
|
||||||
)
|
)
|
||||||
|
@ -1351,6 +1351,10 @@ fn into_raw_pad_task<F: FnMut() + Send + 'static>(func: F) -> gpointer {
|
||||||
Box::into_raw(func) as gpointer
|
Box::into_raw(func) as gpointer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe extern "C" fn destroy_closure_pad_task<F>(ptr: gpointer) {
|
||||||
|
Box::<RefCell<F>>::from_raw(ptr as *mut _);
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Reference in a new issue