diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index 5884402d1..cf99c6e84 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -847,9 +847,6 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id, xwl_output->xwl_screen = xwl_screen; if (with_xrandr) { - snprintf(name, MAX_OUTPUT_NAME, "XWAYLAND%d", - xwl_screen_get_next_output_serial(xwl_screen)); - xwl_output->randr_crtc = RRCrtcCreate(xwl_screen->screen, xwl_output); if (!xwl_output->randr_crtc) { ErrorF("Failed creating RandR CRTC\n"); @@ -857,12 +854,17 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id, } RRCrtcSetRotations (xwl_output->randr_crtc, ALL_ROTATIONS); + /* Allocate MAX_OUTPUT_NAME data for the output name, all filled with zeros */ xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name, MAX_OUTPUT_NAME, xwl_output); if (!xwl_output->randr_output) { ErrorF("Failed creating RandR Output\n"); goto err; } + /* Set the default output name to a sensible value */ + snprintf(name, MAX_OUTPUT_NAME, "XWAYLAND%d", + xwl_screen_get_next_output_serial(xwl_screen)); + xwl_output_set_name(xwl_output, name); xwl_output_set_emulated(xwl_output); RRCrtcGammaSetSize(xwl_output->randr_crtc, 256);