xwayland: Log actual error message if available

If X11 initialization fails, print the actual error message if the error
is set, to help with debugging.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1102
This commit is contained in:
Olivier Fourdan 2020-03-02 15:49:07 +01:00 committed by Jonas Ådahl
parent 26e1e495a0
commit 50ff30bf2b

View File

@ -701,7 +701,13 @@ meta_display_init_x11_finish (MetaDisplay *display,
g_assert (g_task_get_source_tag (G_TASK (result)) == meta_display_init_x11); g_assert (g_task_get_source_tag (G_TASK (result)) == meta_display_init_x11);
if (!g_task_propagate_boolean (G_TASK (result), error)) if (!g_task_propagate_boolean (G_TASK (result), error))
return FALSE; {
if (*error == NULL)
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Unknown error");
return FALSE;
}
if (display->x11_display) if (display->x11_display)
return TRUE; return TRUE;
@ -778,8 +784,10 @@ on_x11_initialized (MetaDisplay *display,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
if (!meta_display_init_x11_finish (display, result, NULL)) g_autoptr (GError) error = NULL;
g_critical ("Failed to init X11 display");
if (!meta_display_init_x11_finish (display, result, &error))
g_critical ("Failed to init X11 display: %s", error->message);
} }
#endif #endif