xwayland: Fix xwayland

Don't give us a freed pointer here.
This commit is contained in:
Jasper St. Pierre 2014-02-07 19:26:35 -05:00
parent 8566566451
commit d694260ad2
4 changed files with 9 additions and 16 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -26,8 +26,7 @@
gboolean
meta_xwayland_start (MetaXWaylandManager *manager,
struct wl_display *display,
char **display_name_out);
struct wl_display *display);
void
meta_xwayland_complete_init (void);

View File

@ -286,8 +286,7 @@ x_io_error (Display *display)
gboolean
meta_xwayland_start (MetaXWaylandManager *manager,
struct wl_display *wl_display,
char **display_name_out)
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;
}