From c7f42208c01f370ab566bc26139f6df1fd589029 Mon Sep 17 00:00:00 2001 From: guinux Date: Thu, 15 Sep 2016 11:08:52 +0200 Subject: [PATCH] add timeout to let the time to the daemon to correctly quit after auto refresh --- src/refresh.vala | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/refresh.vala b/src/refresh.vala index b0961da..6bb4266 100644 --- a/src/refresh.vala +++ b/src/refresh.vala @@ -64,14 +64,20 @@ bool check_pamac_running () { } void on_refresh_finished () { - if (!check_pamac_running ()) { - try { - pamac_daemon.quit (); - } catch (IOError e) { - stderr.printf ("IOError: %s\n", e.message); + Timeout.add (1000, () => { + if (!check_pamac_running ()) { + try { + pamac_daemon.quit (); + } catch (IOError e) { + stderr.printf ("IOError: %s\n", e.message); + } } - } - loop.quit (); + Timeout.add (100, () => { + loop.quit (); + return false; + }); + return false; + }); } int main () {