Hi,

some of you might have been experiencing xfce4-session crashes (on amd64
only?) since the upgrade to glib 2.36 - this is a pretty bad regression,
and is tracked upstream in https://bugzilla.xfce.org/show_bug.cgi?id=9709
G_SLICE=always-malloc was a potential workaround to alleviate the
crashes, but the root issue lies in the glib upgrade.

here's a port diff backporting the two last git commits to xfce4-session
working around glib, hopefully fixing it. Let me know how this works.

Landry
Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/xfce4/xfce4-session/Makefile,v
retrieving revision 1.62
diff -u -r1.62 Makefile
--- Makefile    11 Mar 2013 11:46:18 -0000      1.62
+++ Makefile    27 Apr 2013 12:07:10 -0000
@@ -3,7 +3,7 @@
 COMMENT=       Xfce4 session manager
 
 XFCE_PROJECT=  xfce4-session
-REVISION=      3
+REVISION=      4
 
 SHARED_LIBS += xfsm-4.6        1.0 # .0.0
 
Index: patches/patch-xfce4-session_xfsm-startup_c
===================================================================
RCS file: patches/patch-xfce4-session_xfsm-startup_c
diff -N patches/patch-xfce4-session_xfsm-startup_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-xfce4-session_xfsm-startup_c  27 Apr 2013 12:07:10 -0000
@@ -0,0 +1,76 @@
+$OpenBSD$
+http://git.xfce.org/xfce/xfce4-session/patch/?id=ab391138cacc62ab184a338e237c4430356b41f9
+http://git.xfce.org/xfce/xfce4-session/patch/?id=dee0200fa5dc4de064f288281ddd13199ba7fcde
+Tentative fixes at crashes upon app launching or session logout
+--- xfce4-session/xfsm-startup.c.orig  Sat Apr 28 22:43:27 2012
++++ xfce4-session/xfsm-startup.c       Sat Apr 27 12:17:45 2013
+@@ -864,6 +864,7 @@ xfsm_startup_start_properties (XfsmProperties *propert
+   gint             n;
+   const gchar     *current_directory;
+   GPid             pid;
++  GError          *error = NULL;
+ 
+   /* release any possible old resources related to a previous startup */
+   xfsm_properties_set_default_child_watch (properties);
+@@ -878,46 +879,31 @@ xfsm_startup_start_properties (XfsmProperties *propert
+ 
+   current_directory = xfsm_properties_get_string (properties, 
SmCurrentDirectory);
+ 
+-  /* fork a new process for the application */
+-#ifdef HAVE_VFORK
+-  /* vfork() doesn't allow you to do anything but call exec*() or _exit(),
+-   * so if we need to set the working directory, we can't use vfork() */
+-  if (current_directory == NULL)
+-    pid = vfork ();
+-  else
+-#endif
+-    pid = fork ();
+-
+-  /* handle the child process */
+-  if (pid == 0)
++  if (!g_spawn_async (current_directory,
++                      argv, NULL,
++                      G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
++                      NULL, NULL,
++                      &pid, &error))
+     {
+-      /* execute the application here */
+-      if (current_directory)
+-        {
+-          if (chdir (current_directory))
+-            g_warning ("Unable to chdir to \"%s\": %s", current_directory, 
strerror (errno));
+-        }
+-      execvp (argv[0], argv);
+-      _exit (127);
+-    }
++      g_warning ("Unable to launch \"%s\": %s",
++                 *argv, error->message);
++      g_error_free (error);
++      g_strfreev (argv);
+ 
+-  /* cleanup */
+-  g_strfreev (argv);
+-
+-  /* check if we failed to fork */
+-  if (G_UNLIKELY (pid < 0))
+-    {
+-      /* tell the user that we failed to fork */
+-      perror ("Failed to fork new process");
+       return FALSE;
+     }
+ 
++  xfsm_verbose ("Launched command \"%s\" with PID %dn", *argv, (gint) pid);
++
++  g_strfreev (argv);
++
+   properties->pid = pid;
+ 
+   /* set a watch to make sure the child doesn't quit before registering */
+-  child_watch_data = g_new (XfsmStartupData, 1);
++  child_watch_data = g_new0 (XfsmStartupData, 1);
+   child_watch_data->manager = g_object_ref (manager);
+   child_watch_data->properties = properties;
++  child_watch_data->properties->child_watch_id =
+   g_child_watch_add_full (G_PRIORITY_LOW, properties->pid,
+                           xfsm_startup_child_watch, child_watch_data,
+                           (GDestroyNotify) xfsm_startup_data_free);

Reply via email to