To fix a shutdown crash in weston's x11 compositor I want to move the
weston X window close to an idle handler.

Since idle handlers are processed at the start of an event loop, the
handler that deals with window close will run at the start of the
next input_loop dispatch, after which the dispatcher blocks on epoll
forever (since all input events that will ever occur have been consumed).

Moving the idle handler callbacks to after the epoll_wait allows this to
all be completed within a single dispatch, and stops the lock-up from
occurring.

Signed-off-by: Derek Foreman <[email protected]>
---
 src/event-loop.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/event-loop.c b/src/event-loop.c
index 1f571ba..0a61a23 100644
--- a/src/event-loop.c
+++ b/src/event-loop.c
@@ -407,7 +407,6 @@ wl_event_loop_dispatch(struct wl_event_loop *loop, int 
timeout)
        struct wl_event_source *source;
        int i, count, n;
 
-       wl_event_loop_dispatch_idle(loop);
 
        count = epoll_wait(loop->epoll_fd, ep, ARRAY_LENGTH(ep), timeout);
        if (count < 0)
@@ -421,10 +420,12 @@ wl_event_loop_dispatch(struct wl_event_loop *loop, int 
timeout)
 
        wl_event_loop_process_destroy_list(loop);
 
+       wl_event_loop_dispatch_idle(loop);
+
        do {
                n = post_dispatch_check(loop);
        } while (n > 0);
-               
+
        return 0;
 }
 
-- 
2.1.4

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to