[Xfce4-commits] <xfce4-power-manager:master> Change from svn to git+Fix a crash set_client_id

Ali Abdallah aliov at xfce.org
Wed Aug 19 12:14:02 CEST 2009


Updating branch refs/heads/master
         to c89dea930a08dfa52f73a2bb4bfc83a1608a4e0d (commit)
       from 031ba8b620d8cc04cca32fdeea9be72e7aad708e (commit)

commit c89dea930a08dfa52f73a2bb4bfc83a1608a4e0d
Author: Ali Abdallah <aliov at xfce.org>
Date:   Mon Aug 17 20:10:56 2009 +0200

    Change from svn to git+Fix a crash set_client_id

 NEWS               |    1 +
 autogen.sh         |   56 ++++++++++++++++++++++++++--------------------------
 configure.ac.in    |    6 ++--
 src/xfpm-main.c    |    2 +
 src/xfpm-session.c |   15 +++++++++++--
 src/xfpm-session.h |    3 ++
 6 files changed, 49 insertions(+), 34 deletions(-)

diff --git a/NEWS b/NEWS
index bbc0ea4..0007ae6 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
 =======
 - Don't lock screen on lid event when multiple monitor are connected.
 - Force DPMSModeOff on lid close event if it is not done in Hardware.
+- Fix a crash in set_client_id (bug #5673).
 
 0.8.3.1
 =======
diff --git a/autogen.sh b/autogen.sh
index 170897e..8133da6 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,24 +1,35 @@
 #!/bin/sh
 #
-# $Id: autogen.sh 23241 2006-09-29 19:05:15Z kelnos $
-#
-# Copyright (c) 2002-2005
-#         The Xfce development team. All rights reserved.
-#
-# Written for Xfce by Benedikt Meurer <benny at xfce.org>.
-#
+# vi:set et ai sw=2 sts=2 ts=2: */
+# 
+# Copyright (c) 2007-2009 Jannis Pohlmann <jannis at xfce.org>
+# 
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+# 
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+# GNU Library General Public License for more details.
+# 
+# You should have received a copy of the GNU Library General 
+# Public License along with this library; if not, write to the 
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
 
 (type xdt-autogen) >/dev/null 2>&1 || {
   cat >&2 <<EOF
 autogen.sh: You don't seem to have the Xfce development tools installed on
             your system, which are required to build this software.
-            Please install the xfce4-dev-tools package first, available from
-            http://xfce.org/~benny/projects/xfce4-dev-tools/.
+            Please install the xfce4-dev-tools package first, it is available
+            from http://www.xfce.org/.
 EOF
   exit 1
 }
 
-# verify that po/LINGUAS is present
+# Verify that po/LINGUAS is present
 (test -f po/LINGUAS) >/dev/null 2>&1 || {
   cat >&2 <<EOF
 autogen.sh: The file po/LINGUAS could not be found. Please check your snapshot
@@ -27,27 +38,16 @@ EOF
   exit 1
 }
 
-echo 'dnl *** This file is automatically generated from configure.ac.in ***' \
-	>configure.ac
-echo 'dnl *** DO NOT EDIT! ***' >>configure.ac
-echo >>configure.ac
-
-# substitute revision and linguas
-linguas=$(sed -e '/^#/d' po/LINGUAS)
-if [ -d .git/svn ]; then
-    revision=$(git svn find-rev trunk 2>/dev/null ||
-               git svn find-rev origin/trunk 2>/dev/null ||
-               git svn find-rev HEAD 2>/dev/null ||
-               git svn find-rev master 2>/dev/null)
-elif [ -d .svn ]; then
-    revision=$(LC_ALL=C svn info $0 | awk '/^Revision: / {printf "%05d\n", $2}')
+# Substitute revision and linguas
+linguas=`sed -e '/^#/d' po/LINGUAS`
+if test -d .git; then
+  revision=$(git rev-parse --short HEAD 2>/dev/null)
 else
-    revision=UNKNOWN
+  revision="Unknown"
 fi
 sed -e "s/@LINGUAS@/${linguas}/g" \
     -e "s/@REVISION@/${revision}/g" \
-    < "configure.ac.in" >> "configure.ac"
+    < "configure.ac.in" > "configure.ac"
 
-xdt-autogen $@
+exec xdt-autogen $@
 
-# vi:set ts=2 sw=2 et ai:
diff --git a/configure.ac.in b/configure.ac.in
index ae1c503..22f0b0f 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -2,9 +2,9 @@ m4_define([intltool_minimum_version], [0.31])
 m4_define([xfpm_version_major],  [0])
 m4_define([xfpm_version_minor],  [9])
 m4_define([xfpm_version_micro],  [90])
-m4_define([xfpm_version_build],  [])
-m4_define([xfpm_version_tag],[])
-m4_define([xfpm_version], [xfpm_version_major().xfpm_version_minor().xfpm_version_micro()ifelse(xfpm_version_tag(), [svn], [xfpm_version_tag().xfpm_version_build()], [xfpm_version_tag()])])
+m4_define([xfpm_version_build],  [@REVISION@])
+m4_define([xfpm_version_tag],[git])
+m4_define([xfpm_version], [xfpm_version_major().xfpm_version_minor().xfpm_version_micro()ifelse(xfpm_version_tag(), [git], [xfpm_version_tag().xfpm_version_build()], [xfpm_version_tag()])])
 
 AC_INIT([xfce4-power-manager], [xfpm_version], [http://bugzilla.xfce.org/])
 AC_PREREQ(2.50)
diff --git a/src/xfpm-main.c b/src/xfpm-main.c
index 9a20d45..3004567 100644
--- a/src/xfpm-main.c
+++ b/src/xfpm-main.c
@@ -82,6 +82,8 @@ xfpm_start (DBusGConnection *bus)
     
     if ( client_id != NULL )
 	xfpm_session_set_client_id (session, client_id);
+	
+    xfpm_session_real_init (session);
     
     manager = xfpm_manager_new (bus);
     
diff --git a/src/xfpm-session.c b/src/xfpm-session.c
index 38ede11..1daed15 100644
--- a/src/xfpm-session.c
+++ b/src/xfpm-session.c
@@ -59,6 +59,7 @@ struct XfpmSessionPrivate
 {
     SessionClient *client;
     gboolean       managed;
+    gboolean	   initted;
 };
 
 enum
@@ -117,6 +118,7 @@ xfpm_session_init (XfpmSession *session)
     
     session->priv->client = NULL;
     session->priv->managed = FALSE;
+    session->priv->initted = FALSE;
     
     restart_command    = g_new (gchar *, 3);
     restart_command[0] = g_strdup ("xfce4-power-manager");
@@ -140,7 +142,6 @@ xfpm_session_init (XfpmSession *session)
 	return;
     }
     
-    session->priv->managed 	   = session_init (session->priv->client);
     session->priv->client->die     = xfpm_session_die;
 }
 
@@ -219,13 +220,21 @@ xfpm_session_new (void)
     return XFPM_SESSION (xfpm_session_object);
 }
 
+void xfpm_session_real_init (XfpmSession *session)
+{
+    session->priv->managed = session_init (session->priv->client);
+    session->priv->initted = TRUE;
+}
+
 void xfpm_session_set_client_id (XfpmSession *session, const gchar *client_id)
 {
     g_return_if_fail (XFPM_IS_SESSION (session));
+    g_return_if_fail (session->priv->initted == FALSE);
     
-    if ( G_UNLIKELY (session->priv->client == NULL) )
+    if ( G_UNLIKELY (session->priv->client == NULL || session->priv->managed == FALSE) )
 	return;
     
+    TRACE ("Setting client id : %s\n", client_id);
     client_session_set_client_id (session->priv->client, client_id);
 }
 
@@ -233,7 +242,7 @@ void xfpm_session_quit (XfpmSession *session)
 {
     g_return_if_fail (XFPM_IS_SESSION (session));
     
-    if ( !session->priv->managed)
+    if ( G_UNLIKELY (session->priv->client == NULL || session->priv->managed == FALSE) )
 	return;
     
     client_session_set_restart_style (session->priv->client, SESSION_RESTART_NEVER);
diff --git a/src/xfpm-session.h b/src/xfpm-session.h
index 133d705..e40b13a 100644
--- a/src/xfpm-session.h
+++ b/src/xfpm-session.h
@@ -47,8 +47,11 @@ typedef struct
 } XfpmSessionClass;
 
 GType  		      		 xfpm_session_get_type        (void) G_GNUC_CONST;
+
 XfpmSession       		*xfpm_session_new             (void);
 
+void				 xfpm_session_real_init	      (XfpmSession *session);
+
 void			         xfpm_session_set_client_id   (XfpmSession *session,
 							       const gchar *client_id);
 							    



More information about the Xfce4-commits mailing list