From 4fa973007d37e117ae857e8b22edc893567282b0 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Mon, 6 Aug 2018 01:01:21 +0300 Subject: [PATCH] App: Make sure to quit on delete event. Since 9a76c6428a7790d5165d3b1b8fd6a7a41b4b8f59 I've noticed the applciation does not quit properly, and then it's unable to be launched again till it's killed manually. This patch is an attept to correct/workaroud that by calling explcitly gio::ApplicationExt::quit(). --- podcasts-gtk/src/app.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/podcasts-gtk/src/app.rs b/podcasts-gtk/src/app.rs index 7336de5..6dec880 100644 --- a/podcasts-gtk/src/app.rs +++ b/podcasts-gtk/src/app.rs @@ -87,10 +87,24 @@ impl App { window.set_title("Podcasts"); let weak_s = settings.downgrade(); + let weak_app = application.downgrade(); window.connect_delete_event(move |window, _| { - weak_s - .upgrade() - .map(|settings| WindowGeometry::from_window(&window).write(&settings)); + let app = match weak_app.upgrade() { + Some(a) => a, + None => return Inhibit(false), + }; + + let settings = match weak_s.upgrade() { + Some(s) => s, + None => return Inhibit(false), + }; + + info!("Savign window position"); + WindowGeometry::from_window(&window).write(&settings); + + info!("Application is exiting"); + app.quit(); + Inhibit(false) });