Object::set_name() should not accept NULL

This commit is contained in:
Sebastian Dröge 2017-12-20 18:31:08 +02:00
parent 55c8cf69f3
commit d182584c25
2 changed files with 9 additions and 5 deletions

View file

@ -445,6 +445,12 @@ trait_name = "GstObjectExt"
[object.function.return]
nullable = false
[[object.function]]
name = "set_name"
[[object.function.parameter]]
name = "name"
nullable = false
[[object.function]]
name = "get_path_string"
[object.function.return]

View file

@ -86,7 +86,7 @@ pub trait GstObjectExt {
fn set_control_rate(&self, control_rate: ClockTime);
fn set_name<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Result<(), glib::error::BoolError>;
fn set_name(&self, name: &str) -> Result<(), glib::error::BoolError>;
fn set_parent<P: IsA<Object>>(&self, parent: &P) -> Result<(), glib::error::BoolError>;
@ -202,11 +202,9 @@ impl<O: IsA<Object> + IsA<glib::object::Object>> GstObjectExt for O {
}
}
fn set_name<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Result<(), glib::error::BoolError> {
let name = name.into();
let name = name.to_glib_none();
fn set_name(&self, name: &str) -> Result<(), glib::error::BoolError> {
unsafe {
glib::error::BoolError::from_glib(ffi::gst_object_set_name(self.to_glib_none().0, name.0), "Failed to set object name")
glib::error::BoolError::from_glib(ffi::gst_object_set_name(self.to_glib_none().0, name.to_glib_none().0), "Failed to set object name")
}
}