From fb48f8de301b23524ab4d0967754d0eae597e99f Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 6 Oct 2026 22:03:48 +0100 Subject: [PATCH] SystemUpdate: Handle offline notifications after registration The constructor runs during D-Bus registration. Handle the previous update result at startup, when notifications can use the application connection. Test=StarFighter: traced notification withdrawal after registration; no startup assertion. Fixes: f2e743b9d244 ("SystemUpdate: withdraw old notifications on startup (#119)") Signed-off-by: Sean Rhodes --- src/Backends/SystemUpdate.vala | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Backends/SystemUpdate.vala b/src/Backends/SystemUpdate.vala index a5d6b9d9..58d414a1 100644 --- a/src/Backends/SystemUpdate.vala +++ b/src/Backends/SystemUpdate.vala @@ -48,17 +48,19 @@ public class SettingsDaemon.Backends.SystemUpdate : Object { cancellable = new GLib.Cancellable (); - try { - var last_offline_results = Pk.offline_get_results (); + GLib.Application.get_default ().startup.connect (() => { + try { + var last_offline_results = Pk.offline_get_results (); - if (last_offline_results.get_exit_code () != SUCCESS && last_offline_results.get_error_code () != null) { - send_error (last_offline_results.get_error_code ().details); - } else { - GLib.Application.get_default ().withdraw_notification (NOTIFICATION_ID); + if (last_offline_results.get_exit_code () != SUCCESS && last_offline_results.get_error_code () != null) { + send_error (last_offline_results.get_error_code ().details); + } else { + GLib.Application.get_default ().withdraw_notification (NOTIFICATION_ID); + } + } catch (Error e) { + warning ("Couldn't determine last offline results: %s", e.message); } - } catch (Error e) { - warning ("Couldn't determine last offline results: %s", e.message); - } + }); try { prepared_update_monitor = Pk.offline_get_prepared_monitor ();