From e5e2b8e682ffc01c3f281f73061f72cde6bf3c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 16 Feb 2022 12:13:19 +0200 Subject: [PATCH] gstreamer: Fix `downcast_ref()` / `downcast_mut()` impls on `MiniObjectRef` They have to return the `Ref` type and not the owned type. --- gstreamer/src/miniobject.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index 558ad5d7b..cbdc6c10e 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -574,17 +574,17 @@ impl MiniObjectRef { unsafe { from_glib((*self.as_ptr()).type_) } } - pub fn downcast_ref(&self) -> Option<&T> { + pub fn downcast_ref(&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(&mut self) -> Option<&mut T> { + pub fn downcast_mut(&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 }