mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 17:41:05 +00:00
gstreamer/miniobject: ToOwned::to_owned() on references has to create a copy
Otherwise it's possible to create a new owned reference from a mutable reference, and then there is a mutable and immutable reference to the same data at the same time, which is simply not allowed. https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/issues/204
This commit is contained in:
parent
c766f16403
commit
e6f65a5032
1 changed files with 1 additions and 4 deletions
|
@ -855,10 +855,7 @@ macro_rules! gst_define_mini_object_wrapper(
|
|||
type Owned = $name;
|
||||
|
||||
fn to_owned(&self) -> $name {
|
||||
#[allow(clippy::cast_ptr_alignment)]
|
||||
unsafe {
|
||||
$name($crate::glib::translate::from_glib_none($crate::miniobject::MiniObject::as_ptr(self)))
|
||||
}
|
||||
self.copy()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue