summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-10-01 16:57:08 +0200
committerHans de Goede <hdegoede@redhat.com>2010-10-01 16:57:08 +0200
commit1ef6d280d12a264f2a4a5aaa928d305afa38715b (patch)
treefbb235d15fe8ee6d3aefce075e857bfd58318a58
parentc909198eca202f1a2424ce739c541a740dd61281 (diff)
downloadspice-1ef6d280d12a264f2a4a5aaa928d305afa38715b.tar.gz
spice-1ef6d280d12a264f2a4a5aaa928d305afa38715b.tar.xz
spice-1ef6d280d12a264f2a4a5aaa928d305afa38715b.zip
wrap XGetAtomName
XGetAtomName() throws X11 errors when called on a None atom, so wrap it catching the None case.
-rw-r--r--client/x11/platform.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 302b7510..f73f6513 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -173,6 +173,14 @@ static uint32_t get_clipboard_format(uint32_t type) {
return iter->format;
}
+static const char *atom_name(Atom atom)
+{
+ if (atom == None)
+ return "None";
+
+ return XGetAtomName(x_display, atom);
+}
+
NamedPipe::ListenerRef NamedPipe::create(const char *name, ListenerInterface& listener_interface)
{
ASSERT(main_loop && main_loop->is_same_thread(pthread_self()));
@@ -2399,7 +2407,7 @@ static void root_win_proc(XEvent& event)
uint32_t type = get_clipboard_type(selection_request->target);
if (!type) {
- LOG_INFO("Unsupported selection type %s", XGetAtomName(x_display, selection_request->target));
+ LOG_INFO("Unsupported selection type %s", atom_name(selection_request->target));
send_selection_notify(None);
break;
}