From a775f587536bd4a13983603ba114133a73856250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 11 Apr 2021 10:28:06 +0300 Subject: [PATCH] Use glib::Error::into_raw() for passing GErrors without copying back to C --- gstreamer-webrtc/src/web_rtc_data_channel.rs | 8 +------- gstreamer/src/subclass/uri_handler.rs | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/gstreamer-webrtc/src/web_rtc_data_channel.rs b/gstreamer-webrtc/src/web_rtc_data_channel.rs index 62c4c5090..74d5fa02b 100644 --- a/gstreamer-webrtc/src/web_rtc_data_channel.rs +++ b/gstreamer-webrtc/src/web_rtc_data_channel.rs @@ -3,16 +3,10 @@ use crate::WebRTCDataChannel; use glib::translate::*; -use std::mem; - impl WebRTCDataChannel { pub fn on_error(&self, error: glib::Error) { - let error = mem::ManuallyDrop::new(error); unsafe { - ffi::gst_webrtc_data_channel_on_error( - self.to_glib_none().0, - mut_override(error.to_glib_none().0), - ); + ffi::gst_webrtc_data_channel_on_error(self.to_glib_none().0, error.into_raw()); } } } diff --git a/gstreamer/src/subclass/uri_handler.rs b/gstreamer/src/subclass/uri_handler.rs index c2ce8480e..77afdd538 100644 --- a/gstreamer/src/subclass/uri_handler.rs +++ b/gstreamer/src/subclass/uri_handler.rs @@ -146,7 +146,7 @@ unsafe extern "C" fn uri_handler_set_uri( ) { Ok(()) => true.to_glib(), Err(error) => { - *err = error.to_glib_full() as *mut _; + *err = error.into_raw(); false.to_glib() } }