From 428617f87abf2d9cf92723f3a2287b575d7c6180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 26 Jun 2025 18:43:01 +0300 Subject: [PATCH] gstreamer: Add debug assertions to ensure `&mut StructureRef` is only created from mutable structures Part-of: --- gstreamer/src/structure.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index cf657bd1c..7602bb08a 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -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) }