Previously, with add_watch()/add_watch_local() you had to remember
calling remove_watch() in order not to leak the bus, the watch source
and two associated file descriptors. Now these methods instead return an
object of type BusWatchGuard that will automatically remove the bus
watch when the object is dropped.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1248>
warning: unused return value of `std::boxed::Box::<T>::from_raw` that must be used
--> gstreamer-rtsp-server/src/rtsp_session_pool.rs:23:5
|
23 | Box::<F>::from_raw(ptr as *mut _);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
= note: call `drop(from_raw(ptr))` if you intend to drop the `Box`
They don't add any safety as this is via unsafe code anyway and are not
needed to get mutable references in this context anyway, while adding a
bit of runtime overhead.
warning: this expression borrows a value the compiler would automatically borrow
--> gstreamer-rtsp-server/src/rtsp_session_pool.rs:16:5
|
16 | (&mut *func.borrow_mut())(&from_glib_borrow(pool)).into_glib()
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `(*func.borrow_mut())`
|
= note: `#[warn(clippy::needless_borrow)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
This applies to the ones of the appsink, appsrc and bus. If we would
store a strong reference then they would keep alive the underlying
object forever even if their pipeline disappeared in the meantime.
Like this e.g. the bus stream would start returning None once the bus
was destroyed, similar to how other channels are working in Rust.
Previously it was not thread-safe to change them and could lead to
crashes but with 1.16.3 it is now.
Unsetting the bus sync handler before 1.16.3 will have no effect at all,
setting a new bus sync handler or appsink/src callbacks will panic.
This partially reverts 2f88dc6576
This is racy and can cause the consumer of the messages to never be
woken up anymore:
1. Waker is stored because no message on the bus
2. Sync handler is called, waker is woken up
3. Bus is polled again and no message is on it (yet),
new waker is registered
4. Bus stores the message from 2. in its queue (after
the sync handler has returned BusSyncReply::Pass)
5. No new message ever appears on the bus because all
this happened for the very last message
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/235