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/1442>
This commit is contained in:
Seungha Yang 2024-05-16 22:59:15 +09:00 committed by GStreamer Marge Bot
parent b468280353
commit f59029b57c

View file

@ -2910,7 +2910,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)
});
}
@ -3124,4 +3124,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);
}
}