diff --git a/src/devices/gui_window.c b/src/devices/gui_window.c index afb4f266..e753d428 100644 --- a/src/devices/gui_window.c +++ b/src/devices/gui_window.c @@ -258,14 +258,14 @@ bool gui_window_init_auto(rvvm_machine_t* machine, uint32_t width, uint32_t heig return false; } - // Placeholder for window data, region size is 0 - rvvm_mmio_dev_t win_placeholder = { - .data = win, - .type = &gui_window_dev_type, - }; - rvvm_attach_mmio(machine, &win_placeholder); - - framebuffer_init_auto(machine, &win->fb); + rvvm_mmio_dev_t* fb = framebuffer_init_auto(machine, &win->fb); + if (!fb) { + gui_window_free(win); + return false; + } + + fb->data = win; + fb->type = &gui_window_dev_type; return true; }