Return exit code from gio::Application::run() from main()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1208>
This commit is contained in:
Sebastian Dröge 2023-01-27 19:02:03 +02:00
parent 5f05f7ec05
commit a7f670df7a
2 changed files with 12 additions and 8 deletions

View file

@ -158,20 +158,22 @@ fn create_ui(app: &gtk::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
}

View file

@ -259,7 +259,7 @@ fn create_ui(app: &gtk::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
}