summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2014-10-20 17:16:22 -0400
committerRyan Lortie <desrt@desrt.ca>2014-10-21 08:14:49 -0400
commitca145122db54daa17ba9a2b09b35edbd22e548c4 (patch)
tree469ad35ff6d3ec82916527e34d3614433ffbcff7
parent6f703f828b4d35e2a3a09904844c7ae66ef14214 (diff)
downloadgtk+-ca145122db54daa17ba9a2b09b35edbd22e548c4.tar.gz
wayland: don't init if XDG_RUNTIME_DIR missing
wayland doesn't strictly follow the XDG_RUNTIME_DIR spec by falling back to another directory in case the runtime dir is not properly set. When this variable is unset, wayland will log an error to us, which we treat as fatal, aborting the entire program. Skip ourselves all the trouble and don't try to bring up the wayland backend when we know it will fail in this way. https://bugzilla.gnome.org/show_bug.cgi?id=738873
-rw-r--r--gdk/wayland/gdkdisplay-wayland.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 5e71483611..59ce8d4785 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -244,6 +244,13 @@ _gdk_wayland_display_open (const gchar *display_name)
GdkDisplay *display;
GdkWaylandDisplay *display_wayland;
+ /* If this variable is unset then wayland initialisation will surely
+ * fail, logging a fatal error in the process. Save ourselves from
+ * that.
+ */
+ if (g_getenv ("XDG_RUNTIME_DIR") == NULL)
+ return NULL;
+
wl_log_set_handler_client(log_handler);
wl_display = wl_display_connect(display_name);