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>
This commit is contained in:
Ivan Molodetskikh 2021-02-27 10:27:36 +03:00 committed by Marge Bot
parent 2a71ca373b
commit 861d03aac0

View File

@ -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);
if (old_no_at_bridge)
g_setenv ("NO_AT_BRIDGE", old_no_at_bridge, TRUE);
else
g_unsetenv ("NO_AT_BRIDGE");
if (!gdk_display)
{