[Xfce4-commits] <xfce4-session:aliov/hal-deprecation> Create polkit subject only when we have valid data to set, consolkit-session or pid/process start time.

Ali Abdallah noreply at xfce.org
Wed Feb 3 12:24:02 CET 2010


Updating branch refs/heads/aliov/hal-deprecation
         to f0b7814ec07b05a24dbe609f9e38408a341855df (commit)
       from 92c496c8c5fa9bd526e78bffa23e1c764dd062a3 (commit)

commit f0b7814ec07b05a24dbe609f9e38408a341855df
Author: Ali Abdallah <aliov at xfce.org>
Date:   Wed Feb 3 12:19:38 2010 +0100

    Create polkit subject only when we have valid data to set, consolkit-session or pid/process start time.

 xfce4-session/xfsm-shutdown-helper.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/xfce4-session/xfsm-shutdown-helper.c b/xfce4-session/xfsm-shutdown-helper.c
index 63306e9..79e223d 100644
--- a/xfce4-session/xfsm-shutdown-helper.c
+++ b/xfce4-session/xfsm-shutdown-helper.c
@@ -345,9 +345,6 @@ xfsm_shutdown_helper_init_polkit_data (XfsmShutdownHelper *helper)
   if ( !helper->polkit_proxy )
     return FALSE;
 
-  helper->polkit_subject = g_value_array_new (2);
-  helper->polkit_subject_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
   /**
    * This variable should be set by the session manager or by 
    * the login manager (gdm?). under clean Xfce environment
@@ -379,6 +376,11 @@ xfsm_shutdown_helper_init_polkit_data (XfsmShutdownHelper *helper)
 	  if ( G_LIKELY (ret) )
 	    {
 	      GValue val  = { 0 };
+	      helper->polkit_subject = g_value_array_new (2);
+	      helper->polkit_subject_hash = g_hash_table_new_full (g_str_hash, 
+								   g_str_equal, 
+								   g_free, 
+								   NULL);
 	      
 	      g_value_init (&val, G_TYPE_STRING);
 	      g_value_set_string (&val, "unix-session");
@@ -418,6 +420,13 @@ xfsm_shutdown_helper_init_polkit_data (XfsmShutdownHelper *helper)
       if ( G_LIKELY (start_time != 0 ) )
 	{
 	  GValue val = { 0 }, pid_val = { 0 }, start_time_val = { 0 };
+	  
+	  helper->polkit_subject = g_value_array_new (2);
+	  helper->polkit_subject_hash = g_hash_table_new_full (g_str_hash, 
+							       g_str_equal, 
+							       g_free, 
+							       NULL);
+
 	  g_value_init (&val, G_TYPE_STRING);
 	  g_value_set_string (&val, "unix-process");
 	  g_value_array_append (helper->polkit_subject, &val);
@@ -432,6 +441,11 @@ xfsm_shutdown_helper_init_polkit_data (XfsmShutdownHelper *helper)
 	  g_value_set_uint64 (&start_time_val, start_time);
 	  g_hash_table_insert (helper->polkit_subject_hash, g_strdup ("start-time"), &start_time_val);
 	}
+      else
+	{
+	  g_warning ("Unable to create Polkit subject");
+	  return FALSE;
+	}
     }
 
   g_value_init (&hash_elem, 



More information about the Xfce4-commits mailing list