[mutter/wayland] xwayland: Fix xwayland



commit d694260ad2dceeb498ff15268a75db656f5360f9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Feb 7 19:26:35 2014 -0500

    xwayland: Fix xwayland
    
    Don't give us a freed pointer here.

 src/wayland/meta-wayland-private.h  |    1 +
 src/wayland/meta-wayland.c          |    6 ++----
 src/wayland/meta-xwayland-private.h |    5 ++---
 src/wayland/meta-xwayland.c         |   13 ++++---------
 4 files changed, 9 insertions(+), 16 deletions(-)
---
diff --git a/src/wayland/meta-wayland-private.h b/src/wayland/meta-wayland-private.h
index f12fff6..cba6ed3 100644
--- a/src/wayland/meta-wayland-private.h
+++ b/src/wayland/meta-wayland-private.h
@@ -68,6 +68,7 @@ typedef struct
   pid_t pid;
   struct wl_client *client;
   struct wl_resource *xserver_resource;
+  char *display_name;
 
   GMainLoop *init_loop;
 } MetaXWaylandManager;
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 22de965..254b4d0 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -623,7 +623,6 @@ meta_wayland_init (void)
 {
   MetaWaylandCompositor *compositor = &_meta_wayland_compositor;
   MetaMonitorManager *monitors;
-  char *display_name;
   int drm_fd;
 
   memset (compositor, 0, sizeof (MetaWaylandCompositor));
@@ -720,11 +719,10 @@ meta_wayland_init (void)
    * and so EGL must be initialized by this point.
    */
 
-  if (!meta_xwayland_start (&compositor->xwayland_manager, compositor->wayland_display, &display_name))
+  if (!meta_xwayland_start (&compositor->xwayland_manager, compositor->wayland_display))
     g_error ("Failed to start X Wayland");
 
-  set_gnome_env ("DISPLAY", display_name);
-
+  set_gnome_env ("DISPLAY", compositor->xwayland_manager.display_name);
   set_gnome_env ("WAYLAND_DISPLAY", compositor->display_name);
 }
 
diff --git a/src/wayland/meta-xwayland-private.h b/src/wayland/meta-xwayland-private.h
index 721debf..83b2986 100644
--- a/src/wayland/meta-xwayland-private.h
+++ b/src/wayland/meta-xwayland-private.h
@@ -25,9 +25,8 @@
 #include <glib.h>
 
 gboolean
-meta_xwayland_start (MetaXWaylandManager  *manager,
-                     struct wl_display    *display,
-                     char                **display_name_out);
+meta_xwayland_start (MetaXWaylandManager *manager,
+                     struct wl_display   *display);
 
 void
 meta_xwayland_complete_init (void);
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 89025af..753af78 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -285,9 +285,8 @@ x_io_error (Display *display)
 }
 
 gboolean
-meta_xwayland_start (MetaXWaylandManager  *manager,
-                     struct wl_display    *wl_display,
-                     char                **display_name_out)
+meta_xwayland_start (MetaXWaylandManager *manager,
+                     struct wl_display   *wl_display)
 {
   int display = 0;
   char *lockfile = NULL;
@@ -295,7 +294,6 @@ meta_xwayland_start (MetaXWaylandManager  *manager,
   pid_t pid;
   char **env;
   char *fd_string;
-  char *display_name;
   char *log_path;
   char *args[11];
   GError *error;
@@ -356,11 +354,11 @@ meta_xwayland_start (MetaXWaylandManager  *manager,
   env = g_environ_setenv (env, "WAYLAND_SOCKET", fd_string, TRUE);
   g_free (fd_string);
 
-  display_name = g_strdup_printf (":%d", manager->display_index);
+  manager->display_name = g_strdup_printf (":%d", manager->display_index);
   log_path = g_build_filename (g_get_user_cache_dir (), "xwayland.log", NULL);
 
   args[0] = XWAYLAND_PATH;
-  args[1] = display_name;
+  args[1] = manager->display_name;
   args[2] = "-wayland";
   args[3] = "-rootless";
   args[4] = "-retro";
@@ -398,7 +396,6 @@ meta_xwayland_start (MetaXWaylandManager  *manager,
     }
 
   g_strfreev (env);
-  g_free (display_name);
   g_free (log_path);
 
   /* We need to run a mainloop until we know xwayland has a binding
@@ -407,8 +404,6 @@ meta_xwayland_start (MetaXWaylandManager  *manager,
   manager->init_loop = g_main_loop_new (NULL, FALSE);
   g_main_loop_run (manager->init_loop);
 
-  *display_name_out = display_name;
-
   return TRUE;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]