Skip to content

gmain: g_main_context_check() can skip updating polled FD sources

If there is a file descriptor source that has a lower priority than the one for sources that are going to be dispatched, all subsequent file descriptor sources (internally sorted by file descriptor identifier) do not get an update in their GPollRec and later on wrong sources can be dispatched.

Fix this by first finding the first GPollRec that matches the current GPollFD, instead of relying on it to be the current one. Additionally add a few comments to explain how the iteration works.

Added a new test that reproduces the bug by creating two file descriptor sources and an idle one. Since the first file descriptor created has a lower identifier and a low priority, the second one is not dispatched even when it has the same, higher, priority as the idle source. After fixing this bug, both higher priority sources are dispatched as expected.

Fixes #1592 (closed)

Edited by Claudio Saavedra

Merge request reports