mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-09-01 17:33:50 +00:00
gstreamer: Add debug assertions to ensure &mut StructureRef
is only created from mutable structures
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1743>
This commit is contained in:
parent
7daf6d9625
commit
428617f87a
1 changed files with 2 additions and 0 deletions
|
@ -483,6 +483,8 @@ impl StructureRef {
|
|||
#[inline]
|
||||
pub unsafe fn from_glib_borrow_mut<'a>(ptr: *mut ffi::GstStructure) -> &'a mut StructureRef {
|
||||
debug_assert!(!ptr.is_null());
|
||||
#[cfg(feature = "v1_28")]
|
||||
debug_assert_ne!(ffi::gst_structure_is_writable(ptr), glib::ffi::GFALSE,);
|
||||
|
||||
&mut *(ptr as *mut StructureRef)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue