diff options
author | Ben Brewer <benbrewer@codethink.co.uk> | 2013-07-25 13:44:29 +0100 |
---|---|---|
committer | Tanu Kaskinen <tanu.kaskinen@linux.intel.com> | 2013-10-29 19:14:00 +0200 |
commit | 68156d3f79b67c77f88050e6c9de180698377c64 (patch) | |
tree | 2e799b7843af8ead7bbb5a3030f4a5b6bc3328a9 /src/pulse/mainloop.c | |
parent | 81f0eb626e7a4f5b0e5fc6f35049c6a9a5fdf8c0 (diff) |
mainloop, glib-mainloop: time_restart could cause incorrect event ordering
This fixes a bug where calling time_restart can leave the current event
in the cache, even though the restart scheduled the event in the future.
This would cause the event to get executed more frequently than it should.
Diffstat (limited to 'src/pulse/mainloop.c')
-rw-r--r-- | src/pulse/mainloop.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c index 60fbbb906..0e1fba047 100644 --- a/src/pulse/mainloop.c +++ b/src/pulse/mainloop.c @@ -379,13 +379,15 @@ static void mainloop_time_restart(pa_time_event *e, const struct timeval *tv) { pa_mainloop_wakeup(e->mainloop); } + if (e->mainloop->cached_next_time_event == e) + e->mainloop->cached_next_time_event = NULL; + if (e->mainloop->cached_next_time_event && e->enabled) { pa_assert(e->mainloop->cached_next_time_event->enabled); if (t < e->mainloop->cached_next_time_event->time) e->mainloop->cached_next_time_event = e; - } else if (e->mainloop->cached_next_time_event == e) - e->mainloop->cached_next_time_event = NULL; + } } static void mainloop_time_free(pa_time_event *e) { |