forked from mirrors/gstreamer-rs
Make sure to hold MutexGuard for the remainder of the function in various places
Not assigning it to a variable would cause it to be dropped immediately and the lock to be released again immediately.
This commit is contained in:
parent
50234bb5e6
commit
98ecef7153
6 changed files with 11 additions and 11 deletions
|
@ -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 _);
|
||||
::utils::MutexGuard::lock(&ptr.parent.object.lock);
|
||||
let _guard = ::utils::MutexGuard::lock(&ptr.parent.object.lock);
|
||||
from_glib_none(&ptr.segment as *const gst_sys::GstSegment)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
|||
fn get_segment(&self) -> gst::Segment {
|
||||
unsafe {
|
||||
let sink: &gst_base_sys::GstBaseSink = &*(self.as_ptr() as *const _);
|
||||
::utils::MutexGuard::lock(&sink.element.object.lock);
|
||||
let _guard = ::utils::MutexGuard::lock(&sink.element.object.lock);
|
||||
from_glib_none(&sink.segment as *const _)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
|||
fn get_segment(&self) -> gst::Segment {
|
||||
unsafe {
|
||||
let src: &gst_base_sys::GstBaseSrc = &*(self.as_ptr() as *const _);
|
||||
::utils::MutexGuard::lock(&src.element.object.lock);
|
||||
let _guard = ::utils::MutexGuard::lock(&src.element.object.lock);
|
||||
from_glib_none(&src.segment as *const _)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ impl<O: IsA<BaseTransform>> BaseTransformExtManual for O {
|
|||
fn get_segment(&self) -> gst::Segment {
|
||||
unsafe {
|
||||
let trans: &gst_base_sys::GstBaseTransform = &*(self.as_ptr() as *const _);
|
||||
::utils::MutexGuard::lock(&trans.element.object.lock);
|
||||
let _guard = ::utils::MutexGuard::lock(&trans.element.object.lock);
|
||||
from_glib_none(&trans.segment as *const _)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ impl<O: IsA<Bin>> GstBinExtManual for O {
|
|||
fn get_children(&self) -> Vec<Element> {
|
||||
unsafe {
|
||||
let bin: &gst_sys::GstBin = &*(self.as_ptr() as *const _);
|
||||
::utils::MutexGuard::lock(&bin.element.object.lock);
|
||||
let _guard = ::utils::MutexGuard::lock(&bin.element.object.lock);
|
||||
FromGlibPtrContainer::from_glib_none(bin.children)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -505,7 +505,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
fn get_pads(&self) -> Vec<Pad> {
|
||||
unsafe {
|
||||
let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _);
|
||||
::utils::MutexGuard::lock(&elt.object.lock);
|
||||
let _guard = ::utils::MutexGuard::lock(&elt.object.lock);
|
||||
FromGlibPtrContainer::from_glib_none(elt.pads)
|
||||
}
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
fn get_sink_pads(&self) -> Vec<Pad> {
|
||||
unsafe {
|
||||
let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _);
|
||||
::utils::MutexGuard::lock(&elt.object.lock);
|
||||
let _guard = ::utils::MutexGuard::lock(&elt.object.lock);
|
||||
FromGlibPtrContainer::from_glib_none(elt.sinkpads)
|
||||
}
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
fn get_src_pads(&self) -> Vec<Pad> {
|
||||
unsafe {
|
||||
let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _);
|
||||
::utils::MutexGuard::lock(&elt.object.lock);
|
||||
let _guard = ::utils::MutexGuard::lock(&elt.object.lock);
|
||||
FromGlibPtrContainer::from_glib_none(elt.srcpads)
|
||||
}
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
fn num_pads(&self) -> u16 {
|
||||
unsafe {
|
||||
let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _);
|
||||
::utils::MutexGuard::lock(&elt.object.lock);
|
||||
let _guard = ::utils::MutexGuard::lock(&elt.object.lock);
|
||||
elt.numpads
|
||||
}
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
fn num_sink_pads(&self) -> u16 {
|
||||
unsafe {
|
||||
let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _);
|
||||
::utils::MutexGuard::lock(&elt.object.lock);
|
||||
let _guard = ::utils::MutexGuard::lock(&elt.object.lock);
|
||||
elt.numsinkpads
|
||||
}
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
fn num_src_pads(&self) -> u16 {
|
||||
unsafe {
|
||||
let elt: &gst_sys::GstElement = &*(self.as_ptr() as *const _);
|
||||
::utils::MutexGuard::lock(&elt.object.lock);
|
||||
let _guard = ::utils::MutexGuard::lock(&elt.object.lock);
|
||||
elt.numsrcpads
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue