mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
event-loop: Fix idle handler dispatch corner case
When the last idle handler queues another idle handler, we fail to dispatch that last handler. The wl_list_for_each_safe loop looks up the next pointer before running the handler, and at that point it points to the head of the list and the loop terminates. Instead, just loop until the list is empty.
This commit is contained in:
parent
7e57dc143e
commit
f86338d611
1 changed files with 4 additions and 2 deletions
|
|
@ -434,9 +434,11 @@ post_dispatch_check(struct wl_event_loop *loop)
|
|||
static void
|
||||
dispatch_idle_sources(struct wl_event_loop *loop)
|
||||
{
|
||||
struct wl_event_source_idle *source, *next;
|
||||
struct wl_event_source_idle *source;
|
||||
|
||||
wl_list_for_each_safe(source, next, &loop->idle_list, base.link) {
|
||||
while (!wl_list_empty(&loop->idle_list)) {
|
||||
source = container_of(loop->idle_list.next,
|
||||
struct wl_event_source_idle, base.link);
|
||||
source->func(source->base.data);
|
||||
wl_event_source_remove(&source->base);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue