mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-21 01:26:28 +00:00
Mark GMutex mutex guards as #[must_use]
See gstreamer-rs commit b21f5764309f9f65666016a9069e1b938935e6f2
This commit is contained in:
parent
7173790da2
commit
4206b53c09
3 changed files with 3 additions and 1 deletions
|
@ -85,6 +85,7 @@ pub fn set_element_flags<T: glib::IsA<gst::Object> + glib::IsA<gst::Element>>(
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use = "if unused the Mutex will immediately unlock"]
|
||||
struct MutexGuard<'a>(&'a glib_ffi::GMutex);
|
||||
|
||||
impl<'a> MutexGuard<'a> {
|
||||
|
|
|
@ -21,7 +21,7 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O {
|
|||
fn get_segment(&self) -> gst::Segment {
|
||||
unsafe {
|
||||
let ptr: &gst_base_sys::GstAggregatorPad = &*(self.as_ptr() as *const _);
|
||||
super::utils::MutexGuard::lock(&ptr.parent.object.lock);
|
||||
let _guard = super::utils::MutexGuard::lock(&ptr.parent.object.lock);
|
||||
from_glib_none(&ptr.segment as *const gst_sys::GstSegment)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
use glib::translate::mut_override;
|
||||
use glib_sys;
|
||||
|
||||
#[must_use = "if unused the Mutex will immediately unlock"]
|
||||
pub struct MutexGuard<'a>(&'a glib_sys::GMutex);
|
||||
|
||||
impl<'a> MutexGuard<'a> {
|
||||
|
|
Loading…
Reference in a new issue