From 520a9bb879442ee5beab40a4b0eeb91c2ada4235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 9 Dec 2017 18:08:57 +0200 Subject: [PATCH] Use downcast_unchecked() for sender in deep-notify signal handler This is guaranteed to be of the correct type. --- gstreamer/src/object.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gstreamer/src/object.rs b/gstreamer/src/object.rs index 4bda95890..bb7dfc105 100644 --- a/gstreamer/src/object.rs +++ b/gstreamer/src/object.rs @@ -7,10 +7,10 @@ // except according to those terms. use glib; -use glib::{Cast, IsA}; +use glib::IsA; use glib::translate::ToGlibPtr; use glib::signal::SignalHandlerId; -use glib::object::ObjectExt; +use glib::object::{Downcast, ObjectExt}; use gobject_ffi; @@ -29,7 +29,12 @@ impl + IsA + glib::value::SetValue> GstObjectExtM f: F, ) -> SignalHandlerId { self.connect("deep-notify", false, move |values| { - let obj: O = values[0].get::().unwrap().downcast().unwrap(); + let obj: O = unsafe { + values[0] + .get::() + .unwrap() + .downcast_unchecked() + }; let prop_obj: ::Object = values[1].get().unwrap(); let prop_name = unsafe {