forked from mirrors/gstreamer-rs
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;
|
type Owned = $name;
|
||||||
|
|
||||||
fn to_owned(&self) -> $name {
|
fn to_owned(&self) -> $name {
|
||||||
#[allow(clippy::cast_ptr_alignment)]
|
self.copy()
|
||||||
unsafe {
|
|
||||||
$name($crate::glib::translate::from_glib_none($crate::miniobject::MiniObject::as_ptr(self)))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue