Skip to content

Commit

Permalink
Mark Widget::destroy as unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 20, 2020
1 parent 61b2f4f commit 043fe42
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2458,6 +2458,10 @@ manual_traits = ["WidgetExtManual"]
[[object.function]]
name = "get_name"
rename = "get_widget_name"
[[object.function]]
name = "destroy"
# needs to be marked as unsafe
ignore = true

[[object]]
name = "Gtk.Window"
Expand Down
8 changes: 0 additions & 8 deletions src/auto/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ pub trait WidgetExt: 'static {

fn create_pango_layout(&self, text: Option<&str>) -> Option<pango::Layout>;

fn destroy(&self);

//fn destroyed<P: IsA<Widget>>(&self, widget_pointer: &P);

fn device_is_shadowed(&self, device: &gdk::Device) -> bool;
Expand Down Expand Up @@ -1117,12 +1115,6 @@ impl<O: IsA<Widget>> WidgetExt for O {
}
}

fn destroy(&self) {
unsafe {
gtk_sys::gtk_widget_destroy(self.as_ref().to_glib_none().0);
}
}

//fn destroyed<P: IsA<Widget>>(&self, widget_pointer: &P) {
// unsafe { TODO: call gtk_sys:gtk_widget_destroyed() }
//}
Expand Down
6 changes: 6 additions & 0 deletions src/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ pub trait WidgetExtManual: 'static {
fn add_events(&self, events: gdk::EventMask);
fn get_events(&self) -> gdk::EventMask;
fn set_events(&self, events: gdk::EventMask);

unsafe fn destroy(&self);
}

impl<O: IsA<Widget>> WidgetExtManual for O {
Expand Down Expand Up @@ -236,4 +238,8 @@ impl<O: IsA<Widget>> WidgetExtManual for O {
gtk_sys::gtk_widget_set_events(self.as_ref().to_glib_none().0, events.to_glib() as i32);
}
}

unsafe fn destroy(&self) {
gtk_sys::gtk_widget_destroy(self.as_ref().to_glib_none().0);
}
}

0 comments on commit 043fe42

Please sign in to comment.