From 4206b53c09ce049c68b6c8decdc220f6687468b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 8 Apr 2020 15:24:07 +0300 Subject: [PATCH] Mark GMutex mutex guards as #[must_use] See gstreamer-rs commit b21f5764309f9f65666016a9069e1b938935e6f2 --- generic/threadshare/src/lib.rs | 1 + utils/fallbackswitch/src/base/aggregator_pad.rs | 2 +- utils/fallbackswitch/src/base/utils.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/threadshare/src/lib.rs b/generic/threadshare/src/lib.rs index 42ecc114..beb53569 100644 --- a/generic/threadshare/src/lib.rs +++ b/generic/threadshare/src/lib.rs @@ -85,6 +85,7 @@ pub fn set_element_flags + glib::IsA>( } } +#[must_use = "if unused the Mutex will immediately unlock"] struct MutexGuard<'a>(&'a glib_ffi::GMutex); impl<'a> MutexGuard<'a> { diff --git a/utils/fallbackswitch/src/base/aggregator_pad.rs b/utils/fallbackswitch/src/base/aggregator_pad.rs index eb57f614..38c47327 100644 --- a/utils/fallbackswitch/src/base/aggregator_pad.rs +++ b/utils/fallbackswitch/src/base/aggregator_pad.rs @@ -21,7 +21,7 @@ impl> 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) } } diff --git a/utils/fallbackswitch/src/base/utils.rs b/utils/fallbackswitch/src/base/utils.rs index dca8cf69..ff456cd0 100644 --- a/utils/fallbackswitch/src/base/utils.rs +++ b/utils/fallbackswitch/src/base/utils.rs @@ -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> {