gnome-power-manager r3317 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r3317 - in trunk: . src
- Date: Mon, 2 Mar 2009 08:49:50 +0000 (UTC)
Author: rhughes
Date: Mon Mar 2 08:49:50 2009
New Revision: 3317
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3317&view=rev
Log:
2009-03-02 Richard Hughes <richard hughsie com>
* src/gpm-inhibit.c: (gpm_inhibit_inhibit),
(gpm_inhibit_un_inhibit), (gpm_inhibit_remove_dbus),
(gpm_inhibit_init), (gpm_inhibit_finalize):
Don't crash if there's no gnome-session.
Fixes #485103
Modified:
trunk/ChangeLog
trunk/src/gpm-inhibit.c
Modified: trunk/src/gpm-inhibit.c
==============================================================================
--- trunk/src/gpm-inhibit.c (original)
+++ trunk/src/gpm-inhibit.c Mon Mar 2 08:49:50 2009
@@ -154,6 +154,10 @@
return;
}
+ /* if there's no gnome-session, this will be NULL */
+ if (inhibit->priv->proxy_session == NULL)
+ goto skip;
+
/* proxy to gnome-session */
ret = dbus_g_proxy_call (inhibit->priv->proxy_session, "Inhibit", &error,
G_TYPE_STRING, application, /* app_id */
@@ -169,6 +173,7 @@
return;
}
+skip:
/* seems okay, add to list */
data = g_new (GpmInhibitData, 1);
data->cookie = inhibit_cookie;
@@ -222,6 +227,10 @@
}
egg_debug ("UnInhibit okay #%i", cookie);
+ /* if there's no gnome-session, this will be NULL */
+ if (inhibit->priv->proxy_session == NULL)
+ goto skip;
+
/* proxy to gnome-session */
ret = dbus_g_proxy_call (inhibit->priv->proxy_session, "Uninhibit", error,
G_TYPE_UINT, cookie,
@@ -232,6 +241,7 @@
return FALSE;
}
+skip:
gpm_inhibit_free_data_object (data);
/* remove it from the list */
@@ -267,6 +277,10 @@
if (strcmp (data->connection, connection) == 0) {
egg_debug ("Auto-revoked idle inhibit on '%s'.", data->application);
+ /* if there's no gnome-session, this will be NULL */
+ if (inhibit->priv->proxy_session == NULL)
+ goto skip;
+
/* proxy to gnome-session */
ret = dbus_g_proxy_call (inhibit->priv->proxy_session, "Uninhibit", &error,
G_TYPE_UINT, data->cookie,
@@ -276,13 +290,12 @@
egg_warning ("failed to proxy: %s", error->message);
g_error_free (error);
}
-
+skip:
gpm_inhibit_free_data_object (data);
/* remove it from the list */
inhibit->priv->list = g_slist_remove (inhibit->priv->list, (gconstpointer) data);
}
}
- return;
}
/**
@@ -464,11 +477,10 @@
inhibit->priv->proxy_session = dbus_g_proxy_new_for_name_owner (connection,
GPM_SESSION_MANAGER_SERVICE, GPM_SESSION_MANAGER_PATH,
- GPM_SESSION_MANAGER_INTERFACE, NULL);
+ GPM_SESSION_MANAGER_INTERFACE, &error);
if (inhibit->priv->proxy_session == NULL) {
egg_warning ("failed to get proxy: %s", error->message);
g_error_free (error);
- return;
}
/* Do we ignore inhibit requests? */
@@ -497,7 +509,8 @@
g_object_unref (inhibit->priv->conf);
g_object_unref (inhibit->priv->proxy);
- g_object_unref (inhibit->priv->proxy_session);
+ if (inhibit->priv->proxy_session != NULL)
+ g_object_unref (inhibit->priv->proxy_session);
G_OBJECT_CLASS (gpm_inhibit_parent_class)->finalize (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]