mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
core: Check environment variables before giving to GAppLaunchContext
Depending on the type of session, one or the other might be NULL, which is not meant to be handled by these functions. Check for both DISPLAY envvars before setting them on the GAppLaunchContext. Closes: https://gitlab.gnome.org/GNOME/mutter/issues/586
This commit is contained in:
parent
6a89e7969f
commit
bf8bc65cc9
@ -110,13 +110,24 @@ static void
|
|||||||
meta_launch_context_constructed (GObject *object)
|
meta_launch_context_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
MetaLaunchContext *context = META_LAUNCH_CONTEXT (object);
|
MetaLaunchContext *context = META_LAUNCH_CONTEXT (object);
|
||||||
|
const char *x11_display, *wayland_display;
|
||||||
|
|
||||||
G_OBJECT_CLASS (meta_launch_context_parent_class)->constructed (object);
|
G_OBJECT_CLASS (meta_launch_context_parent_class)->constructed (object);
|
||||||
|
|
||||||
|
x11_display = getenv ("DISPLAY");
|
||||||
|
wayland_display = getenv ("WAYLAND_DISPLAY");
|
||||||
|
|
||||||
|
if (x11_display)
|
||||||
|
{
|
||||||
g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
|
g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
|
||||||
"DISPLAY", getenv ("DISPLAY"));
|
"DISPLAY", x11_display);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wayland_display)
|
||||||
|
{
|
||||||
g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
|
g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
|
||||||
"WAYLAND_DISPLAY", getenv ("WAYLAND_DISPLAY"));
|
"WAYLAND_DISPLAY", wayland_display);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static gchar *
|
||||||
|
Loading…
Reference in New Issue
Block a user