--- pcmanfm-0.5/src/vfs/vfs-execute.c.debug 2008-05-25 21:59:15.000000000 +0900 +++ pcmanfm-0.5/src/vfs/vfs-execute.c 2009-04-06 17:26:14.000000000 +0900 @@ -131,8 +131,8 @@ { if ( 0 == strncmp( envp[ i ], "DESKTOP_STARTUP_ID=", 19 ) ) startup_id_index = i; - new_env[i] = g_strdup( envp[ i ] ); } + new_env[i] = g_strdup( envp[ i ] ); } display = sn_display_new ( GDK_SCREEN_XDISPLAY ( screen ), @@ -170,8 +170,11 @@ /* This is taken from gdk_spawn_on_screen */ display_name = gdk_screen_make_display_name ( screen ); - if ( display_index >= 0 ) + if ( display_index >= 0 ){ + /* Now display_index points to the last entry of "DISPLAY=" */ + g_free(new_env[ display_index ]); new_env[ display_index ] = g_strconcat( "DISPLAY=", display_name, NULL ); + } else new_env[ i++ ] = g_strconcat( "DISPLAY=", display_name, NULL );