diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2019-05-06 13:00:09 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2019-05-07 16:07:34 +0200 |
commit | 0a3cddeecff8d2c095108fde6c8fd4a3cdc63fe0 (patch) | |
tree | 76121ef93b807051ccae41e1aaf6e7b1a6b8678d | |
parent | ee92e4fe13f7ece3a317e0f792fe594f25443891 (diff) | |
download | mutter-0a3cddeecff8d2c095108fde6c8fd4a3cdc63fe0.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
-rw-r--r-- | src/core/meta-launch-context.c | 19 |
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 * |