Index: slave.c
===================================================================
--- slave.c	(revision 5704)
+++ slave.c	(working copy)
@@ -3563,6 +3563,7 @@
 		   gboolean savesess,
 		   gboolean savelang)
 {
+	const char *old_system_data_dirs;
 	char *sessionexec = NULL;
 	GString *fullexec = NULL;
 	const char *shell = NULL;
@@ -3633,6 +3634,10 @@
 		gdm_child_exit (DISPLAY_REMANAGE,
 				_("%s: Execution of PreSession script returned > 0. Aborting."), "session_child_run");
 
+	old_system_data_dirs = g_getenv ("XDG_DATA_DIRS") ?
+			       g_getenv ("XDG_DATA_DIRS") :
+			       "/usr/local/share/:/usr/share/";
+
 	ve_clearenv ();
 
 	/* Prepare user session */
@@ -3686,13 +3691,8 @@
 	 * using a different display manager.
 	 */
 	{
-		const char *old_system_data_dirs;
 		char *new_system_data_dirs;
 
-		old_system_data_dirs = g_getenv ("XDG_DATA_DIRS") ?
-				       g_getenv ("XDG_DATA_DIRS") :
-				       "/usr/local/share/:/usr/share/";
-
 		new_system_data_dirs = g_build_path (":",
 			 old_system_data_dirs, DATADIR "/gdm/", NULL);
 
