Add the output to the list when it's created rather than when its properties
change (as pointed out by Marek Chalupa).
Remove the output from the list when it's destroyed.

Signed-off-by: Dima Ryazanov <[email protected]>
---
 hw/xwayland/xwayland-output.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 155cbc1..9baf4eb 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -120,8 +120,6 @@ output_handle_done(void *data, struct wl_output *wl_output)
     struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
     int width, height;
 
-    xorg_list_append(&xwl_output->link, &xwl_screen->output_list);
-
     width = 0;
     height = 0;
     xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
@@ -177,6 +175,8 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t 
id)
     xwl_output->randr_crtc = RRCrtcCreate(xwl_screen->screen, xwl_output);
     xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name,
                                               strlen(name), xwl_output);
+    xorg_list_append(&xwl_output->link, &xwl_screen->output_list);
+
     RRCrtcGammaSetSize(xwl_output->randr_crtc, 256);
     RROutputSetCrtcs(xwl_output->randr_output, &xwl_output->randr_crtc, 1);
     RROutputSetConnection(xwl_output->randr_output, RR_Connected);
@@ -190,6 +190,7 @@ xwl_output_destroy(struct xwl_output *xwl_output)
     wl_output_destroy(xwl_output->output);
     RRCrtcDestroy(xwl_output->randr_crtc);
     RROutputDestroy(xwl_output->randr_output);
+    xorg_list_del(&xwl_output->link);
     free(xwl_output);
 }
 
-- 
2.4.0

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to