xwayland: Trap errors when setting primary RANDR output

This will be crucial when we start to remove the global directly when an
output is removed, as that means Xwayland might have removed the output
before we managed to get our queries in.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1796>
This commit is contained in:
Jonas Ådahl 2021-03-23 17:05:13 +01:00
parent 39f80885c1
commit 1dd79c52ad

View File

@ -49,6 +49,7 @@
#include "backends/meta-settings-private.h" #include "backends/meta-settings-private.h"
#include "meta/main.h" #include "meta/main.h"
#include "meta/meta-backend.h" #include "meta/meta-backend.h"
#include "meta/meta-x11-errors.h"
#include "wayland/meta-xwayland-surface.h" #include "wayland/meta-xwayland-surface.h"
#include "x11/meta-x11-display-private.h" #include "x11/meta-x11-display-private.h"
@ -1374,6 +1375,7 @@ meta_xwayland_set_primary_output (MetaX11Display *x11_display)
if (!resources) if (!resources)
return; return;
meta_x11_error_trap_push (x11_display);
for (i = 0; i < resources->noutput; i++) for (i = 0; i < resources->noutput; i++)
{ {
RROutput output_id = resources->outputs[i]; RROutput output_id = resources->outputs[i];
@ -1407,6 +1409,7 @@ meta_xwayland_set_primary_output (MetaX11Display *x11_display)
break; break;
} }
} }
meta_x11_error_trap_pop (x11_display);
XRRFreeScreenResources (resources); XRRFreeScreenResources (resources);
} }