summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2019-05-06 13:00:09 +0200
committerCarlos Garnacho <carlosg@gnome.org>2019-05-06 17:27:56 +0200
commitbf8bc65cc955c893649220bcae9d15c6b36a8383 (patch)
tree010d8f4cce0cd9be7d790017c658d1c7e3471673 /src
parent6a89e7969f1d351dce088eb01ffadaeea6993538 (diff)
downloadmutter-bf8bc65cc955c893649220bcae9d15c6b36a8383.tar.gz
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
Diffstat (limited to 'src')
-rw-r--r--src/core/meta-launch-context.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/core/meta-launch-context.c b/src/core/meta-launch-context.c
index eda51514f..984338c1b 100644
--- a/src/core/meta-launch-context.c
+++ b/src/core/meta-launch-context.c
@@ -110,13 +110,24 @@ static void
meta_launch_context_constructed (GObject *object)
{
MetaLaunchContext *context = META_LAUNCH_CONTEXT (object);
+ const char *x11_display, *wayland_display;
G_OBJECT_CLASS (meta_launch_context_parent_class)->constructed (object);
- g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
- "DISPLAY", getenv ("DISPLAY"));
- g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
- "WAYLAND_DISPLAY", getenv ("WAYLAND_DISPLAY"));
+ x11_display = getenv ("DISPLAY");
+ wayland_display = getenv ("WAYLAND_DISPLAY");
+
+ if (x11_display)
+ {
+ g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
+ "DISPLAY", x11_display);
+ }
+
+ if (wayland_display)
+ {
+ g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (context),
+ "WAYLAND_DISPLAY", wayland_display);
+ }
}
static gchar *