From 56c00d925076e4ba9c3403d544546b383513fa14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Thu, 31 Jan 2019 17:07:04 +0100 Subject: [PATCH] gstreamer: fix parent vfunc invocations when needed Fixes #180 --- gstreamer/src/subclass/element.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gstreamer/src/subclass/element.rs b/gstreamer/src/subclass/element.rs index 0293d84b0..a7cf1b930 100644 --- a/gstreamer/src/subclass/element.rs +++ b/gstreamer/src/subclass/element.rs @@ -1,4 +1,4 @@ -// Copyright (C) 2017,2018 Sebastian Dröge +// Copyright (C) 2017-2019 Sebastian Dröge // // Licensed under the Apache License, Version 2.0 or the MIT license @@ -70,10 +70,10 @@ pub trait ElementImpl: ObjectImpl + Send + Sync + 'static { let data = self.get_type_data(); let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstElementClass; - (*parent_class) + let f = (*parent_class) .change_state - .map(|f| from_glib(f(element.to_glib_none().0, transition.to_glib()))) - .unwrap_or(::StateChangeReturn::Success) + .expect("Missing parent function `change_state`"); + StateChangeReturn::from_glib(f(element.to_glib_none().0, transition.to_glib())) .into_result() } }