--- xfce/thunar/thunar/thunar-window.c~	2006-08-25 15:58:40.000000000 +0100
+++ xfce/thunar/thunar/thunar-window.c	2006-08-25 21:40:33.000000000 +0100
@@ -48,7 +48,7 @@
 #include <thunar/thunar-tree-pane.h>
 #include <thunar/thunar-window.h>
 #include <thunar/thunar-window-ui.h>
-
+#include <string.h>
 
 
 /* Property identifiers */
--- xfce/thunar/thunar-vfs/thunar-vfs-exec.c~	2006-08-25 15:58:45.000000000 +0100
+++ xfce/thunar/thunar-vfs/thunar-vfs-exec.c	2006-11-21 20:27:33.000000000 +0000
@@ -42,6 +42,7 @@
 #include <thunar-vfs/thunar-vfs-exec.h>
 #include <thunar-vfs/thunar-vfs-path-private.h>
 #include <thunar-vfs/thunar-vfs-alias.h>
+#include <sys/wait.h>
 
 #ifdef GDK_WINDOWING_X11
 #include <X11/Xatom.h>
@@ -355,7 +354,17 @@
 }
 #endif
 
+static void thunar_vfs_exec_on_screen_child_watch_cb(GPid pid, gint status, gpointer data)
+{
+	SnLauncherContext *sn_launcher = data;
 
+	waitpid (pid, NULL, 0);
+	g_spawn_close_pid (pid);
+
+	sn_launcher = (SnLauncherContext *) data;
+	if(sn_launcher != NULL)
+	        sn_launcher_context_complete (sn_launcher);
+}
 
 /**
  * thunar_vfs_exec_on_screen:
@@ -390,6 +399,7 @@
 #endif
   gboolean           succeed;
   gchar            **sn_envp = envp;
+  GPid               pid;
 
 #ifdef HAVE_LIBSTARTUP_NOTIFICATION
   /* initialize the sn launcher context */
@@ -425,12 +435,14 @@
             }
         }
     }
+  flags |= G_SPAWN_DO_NOT_REAP_CHILD;
 #endif
 
   /* try to spawn the new process */
-  succeed = gdk_spawn_on_screen (screen, working_directory, argv, sn_envp, flags, NULL, NULL, NULL, error);
+  succeed = gdk_spawn_on_screen (screen, working_directory, argv, sn_envp, flags, NULL, NULL, &pid, error);
 
 #ifdef HAVE_LIBSTARTUP_NOTIFICATION
+  g_child_watch_add (pid, thunar_vfs_exec_on_screen_child_watch_cb, sn_launcher);
   /* handle the sn launcher context */
   if (G_LIKELY (sn_launcher != NULL))
     {
