mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
wayland/client: Free GSubprocessLauncher after spawning
A Meta.WaylandClient() object has a GSubprocessLauncher object passed externally. Currently this object is kept while the WaylandClient object exists, but is is only needed until the call to spawn is made. This patch frees that GSubprocessLauncher just after that call, thus freeing those resources. Fix https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1462
This commit is contained in:
parent
78592cbcc8
commit
5afdbc669d
@ -50,6 +50,7 @@ struct _MetaWaylandClient
|
||||
GSubprocess *subprocess;
|
||||
GCancellable *died_cancellable;
|
||||
gboolean process_running;
|
||||
gboolean process_launched;
|
||||
struct wl_client *wayland_client;
|
||||
};
|
||||
|
||||
@ -165,6 +166,15 @@ meta_wayland_client_spawnv (MetaWaylandClient *client,
|
||||
argv[0][0] != '\0',
|
||||
NULL);
|
||||
|
||||
if (client->process_launched)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"This object already has spawned a subprocess.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (client->launcher == NULL)
|
||||
{
|
||||
g_set_error (error,
|
||||
@ -174,15 +184,6 @@ meta_wayland_client_spawnv (MetaWaylandClient *client,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (client->subprocess != NULL)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"This object already has a process running.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (socketpair (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, client_fd) < 0)
|
||||
{
|
||||
g_set_error (error,
|
||||
@ -197,6 +198,8 @@ meta_wayland_client_spawnv (MetaWaylandClient *client,
|
||||
g_subprocess_launcher_setenv (client->launcher, "WAYLAND_SOCKET", "3", TRUE);
|
||||
wayland_client = wl_client_create (compositor->wayland_display, client_fd[0]);
|
||||
subprocess = g_subprocess_launcher_spawnv (client->launcher, argv, error);
|
||||
g_clear_object (&client->launcher);
|
||||
client->process_launched = TRUE;
|
||||
|
||||
if (subprocess == NULL)
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user