glib/glib/tests
Claudio Saavedra fa45688ff6 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. At
the same time, document the assumptions about the ordering of the
file descriptor records and array and make explicit in the documentation
that the array needs to be passed to g_main_context_check() as it was
received from g_main_context_query().

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.

While this patch was written independently, a similar fix for this
bug was first submitted by Eugene M in GNOME/glib!562. Having a
second fix that basically does the same is a reassurance that we
are in the right here.

Fixes #1592
2020-10-26 13:09:19 +00:00
..
bookmarks tests: Test date overflow failure with bookmark file parsing 2020-10-01 11:46:23 +01:00
markups gmarkup tests: tab character escape/unescape 2020-04-03 16:30:27 +02:00
time-zones tests: Add tests for RFC 8536 v3 parsing of time zones 2020-07-17 15:08:59 +01:00
.gitignore guuid: Add UUID helper functions to GLib 2017-02-06 14:40:38 +01:00
1bit-mutex.c tree: Fix various typos and outdated terminology 2020-06-12 15:01:08 +01:00
4096-random-bytes [REVERT] Bug 548612 – g_strstr_len() should use memmem when available 2008-08-28 23:03:24 +00:00
642026.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
array-test.c Normalize C source files to end with exactly one newline 2020-06-10 09:48:02 +01:00
asyncqueue.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
atomic.c atomic/tests: test g_atomic_pointer_compare_and_exchange() with const pointers 2019-12-13 15:07:35 +01:00
autoptr.c tests: Add some assertions to avoid unused variable warnings on Clang 2020-02-24 16:18:58 +00:00
base64.c tests: Add base64 tests from §(Test Vectors) of RFC 4648 2019-02-27 10:45:02 +00:00
bitlock.c optimise bitlocks with new atomic operations 2011-05-28 17:39:12 -04:00
bookmarkfile.c Add a GBookmarkFile serialization test case 2020-05-30 17:40:52 +01:00
bookmarks.xbel Fix a typo 2010-07-10 23:56:45 -04:00
bytes.c tree: Fix various typos and outdated terminology 2020-06-12 15:01:08 +01:00
cache.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
charset.c glib/gcharset: fix leaking g_get_language_names_with_category 2018-09-20 16:08:19 +02:00
checksum.c gchecksum: add SHA-384 support 2017-02-20 12:40:26 +01:00
collate.c Fix a signedness problem in glib/tests/collate.c 2020-09-14 10:11:44 +02:00
cond.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
convert.c glib/tests/convert.c: Skip tests that aren't meaningful for Windows 2019-06-19 10:55:17 +08:00
dataset.c GDataSet: Add more tests 2014-10-02 14:41:01 -04:00
date.c Fix a signedness problem in glib/tests/date.c 2020-09-14 10:11:44 +02:00
dir.c Add some GDir tests 2010-07-05 23:43:47 -04:00
echo-script spawn: add shebang line to script 2018-12-17 16:19:31 -05:00
echo-script.bat glib/tests/spawn-singlethread: Improve test for Windows 2013-11-11 22:38:36 +08:00
empty Improve test coverage 2011-02-13 23:49:19 -05:00
environment.c genviron: make g_environ_* case-insensitive on Windows 2018-11-28 11:04:48 +01:00
error.c Normalize C source files to end with exactly one newline 2020-06-10 09:48:02 +01:00
fileutils.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
gdatetime.c Add a test for the 6-days-until-EOM bug 2020-10-16 14:52:31 +01:00
getpwuid-preload.c Reproducer for the null pw_name returned from getpwuid() 2020-01-15 14:07:20 +01:00
gpoll.c Use lowercase to include winsock2 2018-12-28 15:30:28 +01:00
gutils-user-database.c Reproducer for the null pw_name returned from getpwuid() 2020-01-15 14:07:20 +01:00
guuid.c guuid: Remove support for curly braces and URN UUIDs 2017-02-06 14:40:38 +01:00
gvariant.c gvariant: Limit recursion in g_variant_parse() 2019-10-18 13:53:18 +01:00
gwakeuptest.c tests: Fix data races in gwakeuptest.c 2018-11-04 17:28:58 +01:00
hash.c Fix various signedness warnings in glib/ghash.c 2019-03-17 19:05:35 +01:00
hmac.c ghmac: Add support for G_CHECKSUM_SHA384 to GHmac 2017-02-20 12:40:26 +01:00
hook.c Normalize C source files to end with exactly one newline 2020-06-10 09:48:02 +01:00
hostutils.c hostutils: accept zoneid in IPv6 addresses 2020-08-05 18:50:13 +04:00
include.c glib/tests/include: port to gtester 2013-11-23 00:39:07 -05:00
io-channel.c giochannel: Fix read_line() when nul is not a line terminator 2020-02-24 14:12:30 +00:00
keyfile.c gkeyfile: Fix parsing of new lines in comments 2018-10-30 11:55:30 +00:00
keyfiletest.ini forgotten file 2010-07-07 22:03:02 -04:00
list.c tests: Don't compare strings by pointer 2020-03-05 09:39:33 +01:00
logging.c tests/logging: Don't hardcode the result of logging a pointer 2018-05-24 23:17:03 +02:00
macros.c Add and use G_SIZEOF_MEMBER() macro 2020-01-21 19:54:55 +04:00
mainloop.c gmain: g_main_context_check() can skip updating polled FD sources 2020-10-26 13:09:19 +00:00
mappedfile.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
markup-collect.c glib/tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-24 11:58:19 +02:00
markup-escape.c gmarkup tests: tab character escape/unescape 2020-04-03 16:30:27 +02:00
markup-parse.c Normalize C source files to end with exactly one newline 2020-06-10 09:48:02 +01:00
markup-subparser.c glib/tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-24 11:58:19 +02:00
markup.c Add a test for g_markup_parse_context_get_element_stack 2014-01-01 17:59:21 -05:00
mem-overflow.c tests: Fix a pragma warning on FreeBSD 2019-08-24 15:49:48 +03:00
meson.build tests: Add tests for RFC 8536 v3 parsing of time zones 2020-07-17 15:08:59 +01:00
mutex.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
node.c Normalize C source files to end with exactly one newline 2020-06-10 09:48:02 +01:00
once.c tests: limit number of threads to something reasonable. 2020-07-07 13:37:30 +01:00
option-argv0.c tree: Fix various typos and outdated terminology 2020-06-12 15:01:08 +01:00
option-context.c Merge branch 'allow_NULL_argument_to_parse_strv' into 'master' 2019-08-27 13:17:39 +00:00
overflow.c glib/tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-24 11:58:19 +02:00
pages.ini Add testcase for bug 640695 2011-01-27 23:07:53 -05:00
pattern.c Normalize C source files to end with exactly one newline 2020-06-10 09:48:02 +01:00
private.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
protocol.c testing: Run tests specified with -p in the order specified 2019-04-29 17:28:55 +01:00
queue.c tests: Add unit tests for g_queue_push_nth_link() 2019-05-02 13:53:09 +01:00
rand.c tests: Convert g_assert() to g_assert_*() in glib/tests/rand.c 2019-03-08 19:46:21 +00:00
rcbox.c Test the alignment of the refcounted box allocations 2018-12-18 11:18:43 +00:00
rec-mutex.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
refcount.c glib/tests/refcount.c: Only expect saturation tests to pass on GCC 2019-06-18 16:42:51 +08:00
refstring.c Normalize C source files to end with exactly one newline 2020-06-10 09:48:02 +01:00
regex.c tree: Fix various ableist language 2020-06-23 10:49:44 +01:00
rwlock.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
scannerapi.c glib/tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-24 11:58:19 +02:00
search-utils.c gstrutils: Set locale explicitly for search-utils test 2020-03-18 08:58:02 +00:00
sequence.c Normalize C source files to end with exactly one newline 2020-06-10 09:48:02 +01:00
shell.c gstrfuncs: Add g_strv_equal() 2018-12-17 17:16:03 +00:00
slice.c Drop g_slice_set_config tests 2015-09-12 11:13:45 -04:00
slist.c tests: Don't compare strings by pointer 2020-03-05 09:39:33 +01:00
sort.c Normalize C source files to end with exactly one newline 2020-06-10 09:48:02 +01:00
spawn-multithreaded.c Add G_SPAWN_DEFAULT to GSpawnFlags 2013-08-17 13:02:25 -04:00
spawn-singlethread.c tree: Fix various ableist language 2020-06-23 10:49:44 +01:00
strfuncs.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
string.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
test-printf.c tree: Fix various typos and outdated terminology 2020-06-12 15:01:08 +01:00
test-spawn-echo.c gthread: move test cases to glib/ 2011-10-16 19:08:59 -04:00
testing-helper.c gtestutils: Add g_test_summary() to add summary metadata to unit tests 2019-05-21 12:33:15 +01:00
testing.c gtestutils: Add a new g_assert_no_errno() test macro 2020-03-04 15:32:25 +00:00
thread-pool.c GThreadPool - Add test for !1340 2020-02-07 16:24:48 +02:00
thread.c tests: Don't assume that unprivileged uids are bound by RLIMIT_NPROC 2020-02-13 17:33:45 +00:00
timeout.c tests: Drop unnecessary usage of g_test_bug_base("") 2019-08-21 19:42:27 +03:00
timer.c tests: Ignore deprecated functions in a few main loop and timer tests 2019-07-29 12:27:29 +01:00
tree.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
unicode.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
unix.c glib-unix: Add g_unix_get_passwd_entry() function 2019-11-26 12:17:04 +00:00
uri.c guri: Add additional tests for scope ID parsing 2020-10-05 14:49:22 +01:00
utf8-misc.c gutf8: Fix length handling in g_utf8_make_valid() 2017-10-25 10:33:48 +01:00
utf8-performance.c glib/tests/: LGPLv2+ -> LGPLv2.1+ 2017-05-24 11:58:19 +02:00
utf8-pointer.c gunicode: Fix UB in gutf8.c and utf8-pointer test 2019-11-14 18:38:03 +00:00
utf8-validate.c Add a missing check to g_utf8_get_char_validated() 2019-09-14 18:01:22 +02:00
utils.c glib: Avoid redefining GLIB_DISABLE_DEPRECATION_WARNINGS 2020-07-27 15:41:09 +01:00
win32.c tree: Fix various typos and outdated terminology 2020-06-12 15:01:08 +01:00