summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2023-03-31 15:09:02 +0200
committerMarge Bot <marge-bot@gnome.org>2023-04-04 18:35:11 +0000
commit1e459c830232a14d6276af699ab864546941d5a9 (patch)
treea7764bba3ad5639793a5e4b800c2d6f02d95c436
parent2e82702084be7c80bdf6cb393ae8efb0c6d4454b (diff)
downloadmutter-1e459c830232a14d6276af699ab864546941d5a9.tar.gz
x11: Wrap X call with error traps
Lest it fails. Try to recover from that and keep reading the mimetypes present in the atom list. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6555 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2945>
-rw-r--r--src/x11/meta-selection-source-x11.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/x11/meta-selection-source-x11.c b/src/x11/meta-selection-source-x11.c
index 4fcb81d42..a4290b6d7 100644
--- a/src/x11/meta-selection-source-x11.c
+++ b/src/x11/meta-selection-source-x11.c
@@ -21,6 +21,7 @@
#include "config.h"
+#include "meta/meta-x11-errors.h"
#include "x11/meta-x11-selection-input-stream-private.h"
#include "x11/meta-selection-source-x11-private.h"
@@ -156,7 +157,13 @@ atoms_to_mimetypes (MetaX11Display *display,
{
const gchar *mimetype;
+ meta_x11_error_trap_push (display);
mimetype = XGetAtomName (xdisplay, atoms[i]);
+ meta_x11_error_trap_pop (display);
+
+ if (!mimetype)
+ continue;
+
mimetypes = g_list_prepend (mimetypes, g_strdup (mimetype));
utf8_text_plain_found |= strcmp (mimetype, "text/plain;charset=utf-8") == 0;