From a7f670df7a41de720aee657d0047eb57ac44bdab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 27 Jan 2023 19:02:03 +0200 Subject: [PATCH] Return exit code from `gio::Application::run()` from `main()` Part-of: --- examples/src/bin/gtksink.rs | 10 ++++++---- examples/src/bin/gtkvideooverlay.rs | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/src/bin/gtksink.rs b/examples/src/bin/gtksink.rs index 61e8ad874..d14e87a64 100644 --- a/examples/src/bin/gtksink.rs +++ b/examples/src/bin/gtksink.rs @@ -158,20 +158,22 @@ fn create_ui(app: >k::Application) { }); } -fn main() { +fn main() -> glib::ExitCode { // Initialize gstreamer and the gtk widget toolkit libraries. gst::init().unwrap(); gtk::init().unwrap(); - { + let res = { let app = gtk::Application::new(None, gio::ApplicationFlags::FLAGS_NONE); app.connect_activate(create_ui); - app.run(); - } + app.run() + }; // Optional, can be used to detect leaks using the leaks tracer unsafe { gst::deinit(); } + + res } diff --git a/examples/src/bin/gtkvideooverlay.rs b/examples/src/bin/gtkvideooverlay.rs index 5662c0991..2846bb703 100644 --- a/examples/src/bin/gtkvideooverlay.rs +++ b/examples/src/bin/gtkvideooverlay.rs @@ -259,7 +259,7 @@ fn create_ui(app: >k::Application) { }); } -fn main() { +fn main() -> glib::ExitCode { #[cfg(not(unix))] { println!("Add support for target platform"); @@ -270,15 +270,17 @@ fn main() { gst::init().unwrap(); gtk::init().unwrap(); - { + let res = { let app = gtk::Application::new(None, gio::ApplicationFlags::FLAGS_NONE); app.connect_activate(create_ui); - app.run(); - } + app.run() + }; // Optional, can be used to detect leaks using the leaks tracer unsafe { gst::deinit(); } + + res }