mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
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,
|
||||
Some(trampoline_pad_task::<F>),
|
||||
into_raw_pad_task(func),
|
||||
Some(destroy_closure::<F>),
|
||||
Some(destroy_closure_pad_task::<F>),
|
||||
),
|
||||
"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
|
||||
}
|
||||
|
||||
unsafe extern "C" fn destroy_closure_pad_task<F>(ptr: gpointer) {
|
||||
Box::<RefCell<F>>::from_raw(ptr as *mut _);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue