r14607 - in /desktop/unstable/gnome-session/debian: changelog patches/02_gsd-spawn.patch
joss at users.alioth.debian.org
joss at users.alioth.debian.org
Sat Feb 16 13:43:21 UTC 2008
Author: joss
Date: Sat Feb 16 13:43:21 2008
New Revision: 14607
URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=14607
Log:
* 02_gsd-spawn.patch: updated to spawn gsd through dbus while still
waiting for it to be started before proceeding. This avoids a race
condition leading to applications being started before g-s-d is
ready. Closes: #454149, #465483.
Modified:
desktop/unstable/gnome-session/debian/changelog
desktop/unstable/gnome-session/debian/patches/02_gsd-spawn.patch
Modified: desktop/unstable/gnome-session/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-session/debian/changelog?rev=14607&op=diff
==============================================================================
--- desktop/unstable/gnome-session/debian/changelog (original)
+++ desktop/unstable/gnome-session/debian/changelog Sat Feb 16 13:43:21 2008
@@ -1,8 +1,15 @@
-gnome-session (2.20.3-2) UNRELEASED; urgency=low
-
+gnome-session (2.20.3-2) unstable; urgency=low
+
+ [ Loic Minier ]
* Include CDBS' utils.
- -- Loic Minier <lool at dooz.org> Thu, 14 Feb 2008 15:33:32 +0100
+ [ Josselin Mouette ]
+ * 02_gsd-spawn.patch: updated to spawn gsd through dbus while still
+ waiting for it to be started before proceeding. This avoids a race
+ condition leading to applications being started before g-s-d is
+ ready. Closes: #454149, #465483.
+
+ -- Josselin Mouette <joss at debian.org> Sat, 16 Feb 2008 14:44:50 +0100
gnome-session (2.20.3-1) unstable; urgency=low
Modified: desktop/unstable/gnome-session/debian/patches/02_gsd-spawn.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-session/debian/patches/02_gsd-spawn.patch?rev=14607&op=diff
==============================================================================
--- desktop/unstable/gnome-session/debian/patches/02_gsd-spawn.patch (original)
+++ desktop/unstable/gnome-session/debian/patches/02_gsd-spawn.patch Sat Feb 16 13:43:21 2008
@@ -1,10 +1,10 @@
Debian #339785
GNOME #500216
Spawn gnome-settings-daemon with g_spawn instead of DBus.
-Index: gnome-session-2.20.1/configure.in
+Index: gnome-session-2.20.3/configure.in
===================================================================
---- gnome-session-2.20.1.orig/configure.in 2007-11-03 01:53:08.948933959 +0100
-+++ gnome-session-2.20.1/configure.in 2007-11-03 02:12:48.712164834 +0100
+--- gnome-session-2.20.3.orig/configure.in 2008-01-07 23:27:27.000000000 +0100
++++ gnome-session-2.20.3/configure.in 2008-02-16 12:33:22.853111710 +0100
@@ -427,6 +427,20 @@ AC_ARG_WITH(rsh-command,
])
AC_SUBST(RSH_COMMAND)
@@ -26,125 +26,150 @@
GNOME_SESSION_TARBALL=`date +%e`
AC_DEFINE_UNQUOTED(GNOME_SESSION_TARBALL_DAY, $GNOME_SESSION_TARBALL,
-Index: gnome-session-2.20.1/gnome-session/gsm-gsd.c
+Index: gnome-session-2.20.3/gnome-session/gsm-gsd.c
===================================================================
---- gnome-session-2.20.1.orig/gnome-session/gsm-gsd.c 2007-11-03 01:53:08.896930996 +0100
-+++ gnome-session-2.20.1/gnome-session/gsm-gsd.c 2007-11-03 02:02:34.993190983 +0100
-@@ -6,15 +6,10 @@
- #include <time.h>
- #include <glib/gi18n.h>
-
--#include <dbus/dbus-glib-lowlevel.h>
--
- #include <gtk/gtkmessagedialog.h>
-
--#include <gnome-settings-daemon/gnome-settings-client.h>
--
+--- gnome-session-2.20.3.orig/gnome-session/gsm-gsd.c 2008-01-07 23:27:23.000000000 +0100
++++ gnome-session-2.20.3/gnome-session/gsm-gsd.c 2008-02-16 14:30:25.847273149 +0100
+@@ -8,12 +8,13 @@
+
+ #include <dbus/dbus-glib-lowlevel.h>
+
+-#include <gtk/gtkmessagedialog.h>
++#include <gtk/gtk.h>
+
+ #include <gnome-settings-daemon/gnome-settings-client.h>
+
typedef struct {
- DBusGProxy *dbus_proxy;
-- gboolean activating;
++ DBusGProxy *dbus_proxy;
+ GPid pid;
+ gboolean activating;
time_t start_time;
guint attempts;
- char *last_error;
-@@ -79,57 +74,25 @@ gsd_error_dialog (GnomeSettingsData *gsd
+@@ -78,6 +79,8 @@ gsd_error_dialog (GnomeSettingsData *gsd
+ gtk_widget_show (dialog);
}
++static void gsd_spawn (gboolean wait_activated);
++
static void
--name_owner_changed (DBusGProxy *proxy,
-- const char *name,
-- const char *prev_owner,
-- const char *new_owner,
-- GnomeSettingsData *gsd)
+ name_owner_changed (DBusGProxy *proxy,
+ const char *name,
+@@ -100,7 +103,7 @@ name_owner_changed (DBusGProxy *proxy,
+
+ gsd->dbus_proxy = NULL;
+
+- gsm_gsd_start ();
++ gsd_spawn (FALSE);
+ }
+ }
+ else
+@@ -111,15 +114,29 @@ name_owner_changed (DBusGProxy *proxy,
+ }
+ }
+
+-void
+-gsm_gsd_start (void)
++static void
+gsd_died_cb (GPid pid, gint status, GnomeSettingsData *gsd)
++{
++ gsd->pid = 0;
++ /* gsd terminated before registering to dbus */
++ if (gsd->activating)
++ {
++ gsd->activating = FALSE;
++ gsd_spawn (FALSE);
++ }
++}
++
++static void
++gsd_spawn (gboolean wait_activated)
{
-- if (!g_ascii_strcasecmp (name, "org.gnome.SettingsDaemon"))
-- {
-- /* gsd terminated */
-- if (!g_ascii_strcasecmp ("", new_owner))
-- {
-- if (!gsd->activating)
-- {
-- gsm_verbose ("gnome-settings-daemon terminated\n");
-- g_return_if_fail (gsd != NULL);
-- /* Previous attempts failed */
-- if (gsd->dbus_proxy == NULL)
-- return;
--
-- gsd->dbus_proxy = NULL;
--
-- gsm_gsd_start ();
-- }
-- }
-- else
-- {
-- gsm_verbose ("gnome-settings-daemon started\n");
-- gsd->activating = FALSE;
-- }
-- }
-+ gsd->pid = 0;
-+ gsm_gsd_start ();
- }
-
- void
- gsm_gsd_start (void)
- {
-- static GnomeSettingsData gsd = { NULL };
-+ static GnomeSettingsData gsd = { 0 };
+ static GnomeSettingsData gsd = { NULL };
time_t now;
-- DBusGConnection *connection;
+ DBusGConnection *connection;
++ DBusGProxy *dbusService;
GError *error = NULL;
+ const gchar *const argv[] = { SETTINGS_DAEMON_PATH, "gnome-settings-daemon", NULL };
- gsm_verbose ("gsm_gsd_start(): starting\n");
-
-- if (gsd.activating)
-+ if (gsd.pid)
+- gsm_verbose ("gsm_gsd_start(): starting\n");
++ gsm_verbose ("gsd_spawn(): starting\n");
+
+ if (gsd.activating)
return;
-
-- if (gsd.dbus_proxy)
-- {
-- gsm_warning ("disconnected...\n");
-- gsd.dbus_proxy = NULL;
-- }
--
- /* stolen from manager.c:client_clean_up() */
- now = time (NULL);
- gsm_verbose ("%ld secs since last attempt\n", now - gsd.start_time);
-@@ -146,60 +109,16 @@ gsm_gsd_start (void)
- return;
- }
-
-- gsd.activating = TRUE;
--
-- connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
-- if (connection == NULL)
+@@ -154,52 +171,74 @@ gsm_gsd_start (void)
+ gsd_set_error (&gsd, error->message);
+ gsd_error_dialog (&gsd, NULL);
+ g_error_free (error);
++ return;
++ }
++
++ dbus_connection_set_exit_on_disconnect (dbus_g_connection_get_connection (connection),
++ FALSE);
++
++ gsd.dbus_proxy = dbus_g_proxy_new_for_name (connection,
++ "org.gnome.SettingsDaemon",
++ "/org/gnome/SettingsDaemon",
++ "org.gnome.SettingsDaemon");
++
++ if (gsd.dbus_proxy == NULL)
++ {
++ gsd_set_error (&gsd, "Could not obtain DBUS proxy");
++ gsd_error_dialog (&gsd, NULL);
++ return;
++ }
++
+ if (g_spawn_async (NULL, (gchar **) argv, NULL,
+ G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_FILE_AND_ARGV_ZERO,
+ NULL, NULL, &gsd.pid, &error))
- {
-- gsd_set_error (&gsd, error->message);
-- gsd_error_dialog (&gsd, NULL);
-- g_error_free (error);
++ {
+ g_child_watch_add (gsd.pid, (GChildWatchFunc) gsd_died_cb, &gsd);
}
else
{
- dbus_connection_set_exit_on_disconnect (dbus_g_connection_get_connection (connection),
- FALSE);
--
++ gsd_set_error (&gsd, error->message);
++ gsd_error_dialog (&gsd, NULL);
++ g_error_free (error);
++ return;
++ }
+
- gsd.dbus_proxy = dbus_g_proxy_new_for_name (connection,
- "org.gnome.SettingsDaemon",
- "/org/gnome/SettingsDaemon",
- "org.gnome.SettingsDaemon");
--
++ dbusService = dbus_g_proxy_new_for_name (connection,
++ DBUS_SERVICE_DBUS,
++ DBUS_PATH_DBUS,
++ DBUS_INTERFACE_DBUS);
++ dbus_g_proxy_add_signal (dbusService,
++ "NameOwnerChanged",
++ G_TYPE_STRING,
++ G_TYPE_STRING,
++ G_TYPE_STRING,
++ G_TYPE_INVALID);
++ dbus_g_proxy_connect_signal (dbusService,
++ "NameOwnerChanged",
++ G_CALLBACK (name_owner_changed),
++ &gsd,
++ NULL);
+
- if (gsd.dbus_proxy == NULL)
-- {
++ if (wait_activated)
++ {
++ while (gsd.activating)
+ {
- gsd_set_error (&gsd, "Could not obtain DBUS proxy");
- gsd_error_dialog (&gsd, NULL);
- }
- else
-- {
++ gtk_main_iteration ();
++ }
++
++ /* if gsd.pid is 0, something broke havoc and the user has already been warned */
++ if (gsd.pid && !org_gnome_SettingsDaemon_awake(gsd.dbus_proxy, &error))
+ {
- if (!org_gnome_SettingsDaemon_awake(gsd.dbus_proxy, &error))
- {
- /* Method failed, the GError is set, let's warn everyone */
@@ -173,9 +198,16 @@
- &gsd,
- NULL);
- }
-- }
-+ gsd_set_error (&gsd, error->message);
-+ gsd_error_dialog (&gsd, NULL);
-+ g_error_free (error);
++ /* Method failed, the GError is set, let's warn everyone */
++ gsd_set_error (&gsd, error->message);
++ gsd_error_dialog (&gsd, NULL);
++ g_error_free (error);
+ }
}
}
++
++void
++gsm_gsd_start (void)
++{
++ gsd_spawn (TRUE);
++}
More information about the pkg-gnome-commits
mailing list