summaryrefslogtreecommitdiffstats
path: root/client/x11
diff options
context:
space:
mode:
Diffstat (limited to 'client/x11')
-rw-r--r--client/x11/platform.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 48d5a52b..9fff947f 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -180,6 +180,18 @@ public:
static DefaultClipboardListener default_clipboard_listener;
static Platform::ClipboardListener* clipboard_listener = &default_clipboard_listener;
+static void handle_x_errors_start(void)
+{
+ handle_x_error = True;
+ x_error_code = 0;
+}
+
+static int handle_x_errors_stop(void)
+{
+ handle_x_error = False;
+ return x_error_code;
+}
+
static const char *atom_name(Atom atom)
{
const char *name;
@@ -188,7 +200,11 @@ static const char *atom_name(Atom atom)
return "None";
XLockDisplay(x_display);
+ handle_x_errors_start();
name = XGetAtomName(x_display, atom);
+ if (handle_x_errors_stop()) {
+ name = "Bad Atom";
+ }
XUnlockDisplay(x_display);
return name;
@@ -317,18 +333,6 @@ Display* XPlatform::get_display()
return x_display;
}
-static void handle_x_errors_start(void)
-{
- handle_x_error = True;
- x_error_code = 0;
-}
-
-static int handle_x_errors_stop(void)
-{
- handle_x_error = False;
- return x_error_code;
-}
-
bool XPlatform::is_x_shm_avail()
{
return x_shm_avail;