From f59029b57c374ac2334ca3f1b05be70ab6a96d24 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 16 May 2024 22:59:15 +0900 Subject: [PATCH] event: Fix leak in SelectStreamsBuilder gst_event_new_select_streams() does not take ownership of GList Part-of: --- gstreamer/src/event.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index 6cdfdd500..7aa3c091c 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -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); + } }