event: Fix leak in SelectStreamsBuilder

gst_event_new_select_streams() does not take ownership of GList

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1447>
This commit is contained in:
Seungha Yang 2024-05-16 22:59:15 +09:00 committed by Sebastian Dröge
parent bc4908eead
commit 93348efcbf

View file

@ -2823,7 +2823,7 @@ impl<'a> SelectStreamsBuilder<'a> {
}
event_builder_generic_impl!(|s: &Self| {
ffi::gst_event_new_select_streams(s.streams.to_glib_full())
ffi::gst_event_new_select_streams(s.streams.to_glib_none().0)
});
}
@ -3037,4 +3037,17 @@ mod tests {
assert_eq!(&*caps, caps2);
}
#[test]
fn test_select_streams() {
crate::init().unwrap();
let s = ["foo", "bar"].to_vec();
let event = crate::event::SelectStreams::new(&s);
let streams = match event.view() {
EventView::SelectStreams(streams) => streams.streams(),
_ => unreachable!(),
};
assert_eq!(streams, s);
}
}