diff --git a/src/core/main.c b/src/core/main.c index 6dabcfe73..8f6133e13 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -887,23 +887,8 @@ void meta_register_with_session (void) { if (!opt_disable_sm) - { - if (opt_client_id == NULL) - { - const gchar *desktop_autostart_id; + meta_session_init (opt_client_id, opt_save_file); - desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID"); - - if (desktop_autostart_id != NULL) - opt_client_id = g_strdup (desktop_autostart_id); - } - - /* Unset DESKTOP_AUTOSTART_ID in order to avoid child processes to - * use the same client id. */ - g_unsetenv ("DESKTOP_AUTOSTART_ID"); - - meta_session_init (opt_client_id, opt_save_file); - } /* Free memory possibly allocated by the argument parsing which are * no longer needed. */ diff --git a/src/x11/session.c b/src/x11/session.c index 8072db727..9d11b6d8a 100644 --- a/src/x11/session.c +++ b/src/x11/session.c @@ -233,6 +233,16 @@ meta_session_init (const char *previous_client_id, SmcCallbacks callbacks; char *saved_client_id; + if (!previous_client_id) + { + const char *desktop_autostart_id; + + desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID"); + if (desktop_autostart_id) + previous_client_id = desktop_autostart_id; + } + g_unsetenv ("DESKTOP_AUTOSTART_ID"); + meta_topic (META_DEBUG_SM, "Initializing session with save file '%s'", previous_save_file ? previous_save_file : "(none)");