[mutter] x11-display: Use unsetenv if old value was NULL



commit 861d03aac06db0666a207e8daa7951ddf21b2849
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Sat Feb 27 10:27:36 2021 +0300

    x11-display: Use unsetenv if old value was NULL
    
    Gets rid of a CRITICAL if NO_AT_BRIDGE was not set before.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1749>

 src/x11/meta-x11-display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index e25e3a3680..88c8f49311 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -1086,7 +1086,11 @@ meta_x11_init_gdk_display (GError **error)
   old_no_at_bridge = g_getenv ("NO_AT_BRIDGE");
   g_setenv ("NO_AT_BRIDGE", "1", TRUE);
   gdk_display = gdk_display_open (xdisplay_name);
-  g_setenv ("NO_AT_BRIDGE", old_no_at_bridge, TRUE);
+
+  if (old_no_at_bridge)
+    g_setenv ("NO_AT_BRIDGE", old_no_at_bridge, TRUE);
+  else
+    g_unsetenv ("NO_AT_BRIDGE");
 
   if (!gdk_display)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]