[gnome-settings-daemon] updates: Correctly clear the offline updates message after the notification
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] updates: Correctly clear the offline updates message after the notification
- Date: Mon, 9 Jul 2012 10:21:16 +0000 (UTC)
commit 55f08fd7b640f8c20370ab06bd08c3a686e455de
Author: Richard Hughes <richard hughsie com>
Date: Mon Jul 9 10:56:27 2012 +0100
updates: Correctly clear the offline updates message after the notification
Using an async call means a double-fork is done, which means pkexec fails with the:
'Refusing to render service to dead parents.' message.
plugins/updates/gsd-updates-manager.c | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/plugins/updates/gsd-updates-manager.c b/plugins/updates/gsd-updates-manager.c
index fbfec41..fd3bd00 100644
--- a/plugins/updates/gsd-updates-manager.c
+++ b/plugins/updates/gsd-updates-manager.c
@@ -80,17 +80,37 @@ G_DEFINE_TYPE (GsdUpdatesManager, gsd_updates_manager, G_TYPE_OBJECT)
static gpointer manager_object = NULL;
static void
+child_exit_cb (GPid pid, gint status, gpointer user_data)
+{
+ g_spawn_close_pid (pid);
+}
+
+static void
clear_offline_updates_message (void)
{
gboolean ret;
GError *error = NULL;
- ret = g_spawn_command_line_async ("pkexec " LIBEXECDIR "/pk-clear-offline-update",
- &error);
+ gchar *argv[3];
+ GPid pid;
+
+ argv[0] = BINDIR "/pkexec";
+ argv[1] = LIBEXECDIR "/pk-clear-offline-update";
+ argv[2] = NULL;
+ ret = g_spawn_async (NULL,
+ argv,
+ NULL,
+ G_SPAWN_DO_NOT_REAP_CHILD,
+ NULL,
+ NULL,
+ &pid,
+ &error);
if (!ret) {
g_warning ("Failure clearing offline update message: %s",
error->message);
g_error_free (error);
+ return;
}
+ g_child_watch_add (pid, child_exit_cb, NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]