mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
xwayland: Make XSetIOErrorExitHandler() mandatory
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
This commit is contained in:
parent
7e974ba6cc
commit
0e8aaebc00
@ -95,9 +95,6 @@
|
|||||||
/* Whether Xwayland has -listenfd option */
|
/* Whether Xwayland has -listenfd option */
|
||||||
#mesondefine HAVE_XWAYLAND_LISTENFD
|
#mesondefine HAVE_XWAYLAND_LISTENFD
|
||||||
|
|
||||||
/* Whether libX11 has XSetIOErrorExitHandler */
|
|
||||||
#mesondefine HAVE_XSETIOERROREXITHANDLER
|
|
||||||
|
|
||||||
/* Whether the mkostemp function exists */
|
/* Whether the mkostemp function exists */
|
||||||
#mesondefine HAVE_MKOSTEMP
|
#mesondefine HAVE_MKOSTEMP
|
||||||
|
|
||||||
|
13
meson.build
13
meson.build
@ -28,6 +28,7 @@ cairo_req = '>= 1.10.0'
|
|||||||
pangocairo_req = '>= 1.20'
|
pangocairo_req = '>= 1.20'
|
||||||
gsettings_desktop_schemas_req = '>= 40.alpha'
|
gsettings_desktop_schemas_req = '>= 40.alpha'
|
||||||
json_glib_req = '>= 0.12.0'
|
json_glib_req = '>= 0.12.0'
|
||||||
|
x11_req = '>= 1.7.0'
|
||||||
xcomposite_req = '>= 0.4'
|
xcomposite_req = '>= 0.4'
|
||||||
xkbcommon_req = '>= 0.4.3'
|
xkbcommon_req = '>= 0.4.3'
|
||||||
xfixes_req = '>= 6'
|
xfixes_req = '>= 6'
|
||||||
@ -145,7 +146,7 @@ if not have_wayland and not have_x11
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if have_x11_client
|
if have_x11_client
|
||||||
x11_dep = dependency('x11')
|
x11_dep = dependency('x11', version: x11_req)
|
||||||
xcomposite_dep = dependency('xcomposite', version: xcomposite_req)
|
xcomposite_dep = dependency('xcomposite', version: xcomposite_req)
|
||||||
xcursor_dep = dependency('xcursor')
|
xcursor_dep = dependency('xcursor')
|
||||||
xdamage_dep = dependency('xdamage')
|
xdamage_dep = dependency('xdamage')
|
||||||
@ -591,15 +592,6 @@ if have_xwayland
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
have_xsetioerrorexithandler = false
|
|
||||||
if have_x11_client
|
|
||||||
if cc.has_function('XSetIOErrorExitHandler', dependencies: x11_dep,
|
|
||||||
prefix: '''#include <X11/Xlib.h>''')
|
|
||||||
have_xsetioerrorexithandler = true
|
|
||||||
cdata.set('HAVE_XSETIOERROREXITHANDLER', 1)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
optional_functions = [
|
optional_functions = [
|
||||||
'mkostemp',
|
'mkostemp',
|
||||||
'posix_fallocate',
|
'posix_fallocate',
|
||||||
@ -678,7 +670,6 @@ summary('Documentation', have_documentation, section: 'Options')
|
|||||||
summary('Profiler', have_profiler, section: 'Options')
|
summary('Profiler', have_profiler, section: 'Options')
|
||||||
summary('Xwayland initfd', have_xwayland_initfd, section: 'Options')
|
summary('Xwayland initfd', have_xwayland_initfd, section: 'Options')
|
||||||
summary('Xwayland listenfd', have_xwayland_listenfd, section: 'Options')
|
summary('Xwayland listenfd', have_xwayland_listenfd, section: 'Options')
|
||||||
summary('Safe X11 I/O errors', have_xsetioerrorexithandler, section: 'Options')
|
|
||||||
summary('Xwayland terminate delay', have_xwayland_terminate_delay, section: 'Options')
|
summary('Xwayland terminate delay', have_xwayland_terminate_delay, section: 'Options')
|
||||||
|
|
||||||
summary('Enabled', have_tests, section: 'Tests')
|
summary('Enabled', have_tests, section: 'Tests')
|
||||||
|
@ -455,16 +455,8 @@ meta_xwayland_terminate (MetaXWaylandManager *manager)
|
|||||||
static int
|
static int
|
||||||
x_io_error (Display *display)
|
x_io_error (Display *display)
|
||||||
{
|
{
|
||||||
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
|
|
||||||
MetaX11DisplayPolicy x11_display_policy;
|
|
||||||
|
|
||||||
g_warning ("Connection to xwayland lost");
|
g_warning ("Connection to xwayland lost");
|
||||||
|
|
||||||
x11_display_policy =
|
|
||||||
meta_context_get_x11_display_policy (compositor->context);
|
|
||||||
if (x11_display_policy == META_X11_DISPLAY_POLICY_MANDATORY)
|
|
||||||
meta_exit (META_EXIT_ERROR);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -474,29 +466,37 @@ x_io_error_noop (Display *display)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XSETIOERROREXITHANDLER
|
|
||||||
static void
|
static void
|
||||||
x_io_error_exit (Display *display,
|
x_io_error_exit (Display *display,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
MetaXWaylandManager *manager = data;
|
MetaXWaylandManager *manager = data;
|
||||||
|
MetaContext *context = manager->compositor->context;
|
||||||
MetaX11DisplayPolicy x11_display_policy;
|
MetaX11DisplayPolicy x11_display_policy;
|
||||||
|
|
||||||
x11_display_policy =
|
x11_display_policy =
|
||||||
meta_context_get_x11_display_policy (manager->compositor->context);
|
meta_context_get_x11_display_policy (context);
|
||||||
|
|
||||||
if (x11_display_policy == META_X11_DISPLAY_POLICY_MANDATORY)
|
if (x11_display_policy == META_X11_DISPLAY_POLICY_MANDATORY)
|
||||||
g_warning ("X Wayland crashed (X IO error)");
|
{
|
||||||
|
GError *error;
|
||||||
|
|
||||||
|
g_warning ("Xwayland terminated, exiting since it was mandatory");
|
||||||
|
error = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||||
|
"Xwayland exited unexpectedly");
|
||||||
|
meta_context_terminate_with_error (context, error);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
meta_topic (META_DEBUG_WAYLAND, "Xwayland disappeared");
|
meta_topic (META_DEBUG_WAYLAND, "Xwayland disappeared");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
x_io_error_exit_noop (Display *display,
|
x_io_error_exit_noop (Display *display,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_xwayland_override_display_number (int number)
|
meta_xwayland_override_display_number (int number)
|
||||||
@ -1114,9 +1114,7 @@ meta_xwayland_setup_xdisplay (MetaXWaylandManager *manager,
|
|||||||
we won't reset the tty).
|
we won't reset the tty).
|
||||||
*/
|
*/
|
||||||
XSetIOErrorHandler (x_io_error);
|
XSetIOErrorHandler (x_io_error);
|
||||||
#ifdef HAVE_XSETIOERROREXITHANDLER
|
|
||||||
XSetIOErrorExitHandler (xdisplay, x_io_error_exit, manager);
|
XSetIOErrorExitHandler (xdisplay, x_io_error_exit, manager);
|
||||||
#endif
|
|
||||||
|
|
||||||
XFixesSetClientDisconnectMode (xdisplay, XFixesClientDisconnectFlagTerminate);
|
XFixesSetClientDisconnectMode (xdisplay, XFixesClientDisconnectFlagTerminate);
|
||||||
}
|
}
|
||||||
@ -1131,23 +1129,19 @@ meta_xwayland_connection_release (MetaXWaylandConnection *connection)
|
|||||||
void
|
void
|
||||||
meta_xwayland_shutdown (MetaXWaylandManager *manager)
|
meta_xwayland_shutdown (MetaXWaylandManager *manager)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_XSETIOERROREXITHANDLER
|
|
||||||
MetaDisplay *display = meta_get_display ();
|
MetaDisplay *display = meta_get_display ();
|
||||||
MetaX11Display *x11_display;
|
MetaX11Display *x11_display;
|
||||||
#endif
|
|
||||||
char path[256];
|
char path[256];
|
||||||
|
|
||||||
g_cancellable_cancel (manager->xserver_died_cancellable);
|
g_cancellable_cancel (manager->xserver_died_cancellable);
|
||||||
|
|
||||||
XSetIOErrorHandler (x_io_error_noop);
|
XSetIOErrorHandler (x_io_error_noop);
|
||||||
#ifdef HAVE_XSETIOERROREXITHANDLER
|
|
||||||
x11_display = display->x11_display;
|
x11_display = display->x11_display;
|
||||||
if (x11_display)
|
if (x11_display)
|
||||||
{
|
{
|
||||||
XSetIOErrorExitHandler (meta_x11_display_get_xdisplay (x11_display),
|
XSetIOErrorExitHandler (meta_x11_display_get_xdisplay (x11_display),
|
||||||
x_io_error_exit_noop, NULL);
|
x_io_error_exit_noop, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
meta_xwayland_terminate (manager);
|
meta_xwayland_terminate (manager);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user