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
19295f75b5
commit
ed80467ff6
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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -502,7 +502,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)
|
||||
}
|
||||
}
|
||||
|
@ -510,7 +510,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)
|
||||
}
|
||||
}
|
||||
|
@ -518,7 +518,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)
|
||||
}
|
||||
}
|
||||
|
@ -526,7 +526,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
|
||||
}
|
||||
}
|
||||
|
@ -534,7 +534,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
|
||||
}
|
||||
}
|
||||
|
@ -542,7 +542,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