gtk-rs / gtk

DEPRECATED, use https://github.com/gtk-rs/gtk3-rs repository instead!
https://gtk-rs.org/
MIT License
1.24k stars 82 forks source link

Mark Widget::destroy as unsafe #958

Closed GuillaumeGomez closed 4 years ago

GuillaumeGomez commented 4 years ago

Part of #957.

cc @sdroege @EPashkin

EPashkin commented 4 years ago

@GuillaumeGomez Thanks. @sdroege How we implement closing application now? Just changing to unsafe{window.destroy();}?

   Compiling gtk-rs-examples v0.0.1 (C:\projects\gtk\_examples)
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
  --> src\bin\menu_bar_system.rs:86:9
   |
86 |         window.destroy();
   |         ^^^^^^^^^^^^^^^^ call to unsafe function
   |
   = note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to previous error
sdroege commented 4 years ago

@sdroege How we implement closing application now? Just changing to unsafe{window.destroy();}?

Just window.close() :)

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

sdroege commented 4 years ago

Looks good to me apart from https://github.com/gtk-rs/gtk/pull/958#discussion_r381716230

And we should first update the examples so that everything continues to compile. Every destroy() call should be replaced with close().

GuillaumeGomez commented 4 years ago

Updated and waiting for https://github.com/gtk-rs/examples/pull/296 now.