mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-05 17:19:42 +00:00
gstreamer: Fix downcast_ref()
/ downcast_mut()
impls on MiniObjectRef
They have to return the `Ref` type and not the owned type.
This commit is contained in:
parent
a1fed48e8c
commit
d68c359db5
1 changed files with 4 additions and 4 deletions
|
@ -574,17 +574,17 @@ impl MiniObjectRef {
|
|||
unsafe { from_glib((*self.as_ptr()).type_) }
|
||||
}
|
||||
|
||||
pub fn downcast_ref<T: IsMiniObject + glib::StaticType>(&self) -> Option<&T> {
|
||||
pub fn downcast_ref<T: IsMiniObject + glib::StaticType>(&self) -> Option<&T::RefType> {
|
||||
if self.type_().is_a(T::static_type()) {
|
||||
unsafe { Some(&*(self as *const Self as *const T)) }
|
||||
unsafe { Some(&*(self as *const Self as *const T::RefType)) }
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn downcast_mut<T: IsMiniObject + glib::StaticType>(&mut self) -> Option<&mut T> {
|
||||
pub fn downcast_mut<T: IsMiniObject + glib::StaticType>(&mut self) -> Option<&mut T::RefType> {
|
||||
if self.type_().is_a(T::static_type()) {
|
||||
unsafe { Some(&mut *(self as *mut Self as *mut T)) }
|
||||
unsafe { Some(&mut *(self as *mut Self as *mut T::RefType)) }
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue