Repository navigation
test: drive the fallback warning countdown with a manual clock (Fixes #3908) - #5427
Merged
Merged
Conversation
…3908) test_fallback_warning_dialog raced its countdowns against wall time: a runner stalled for 2 s inside countdown_moves_the_progress let the dialog finish and delete itself, and the next read dereferenced a null QPointer (the SIGSEGV plus 180-byte leak in #3871). OBSFallbackWarning takes an optional monotonic Clock; empty, as every caller passes, it keeps its QElapsedTimer. The test advances a manual clock and waits on events, checks the dialog is alive before each dereference, and owns Shown in cmocka setup/teardown. Every existing assertion stays; a new case covers the default clock by waiting for the end. Test-only change to our own C++ test, per the decision on #3908. Co-Authored-By: Claude Opus 5.5 <[email protected]> Ci-Attestation: {"at":1795317098,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":93,"stamp":"aae4547e0c056696ca6c52459afa56f7","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317098,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":93,"stamp":"997c1d862365769367c4ca86b979e892","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317098,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":93,"stamp":"24a43744a949101f927ec1796b887ce7","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317098,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":93,"stamp":"02b30f7012013937c8ec08057724c039","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"general/all/client-lint","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"c3c6139588bca0ad557fd9bc92793ff4","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317098,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":93,"stamp":"3dbb8a0b957e9d5fb065417641e5a676","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"298c2c10536aec5ef69e9b0c69758c39","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"576d787bb1466672fefb7e0e8251a0ec","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"187c9e4de37e7b660689022b9a17e54f","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"471d0b401867a2581fd57044d8e84b99","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"f8f0794921073d81668daf2093fe8b13","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"56b76f05068e0f0edb4c1c6b602c19ca","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"63a042ae61ab577f5f15f3e3193f1768","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"dc329bc45a2c2f77fa0893f9769c7202","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"7035f6cb800f5ce247b8786521ebd251","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"f482b96106c412fcea0ba17b48750756","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"124a6065fdb9d1575c29d0fc0841b294","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317004,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"e398822f5e9231ea0ed5d46fc3fcd63badb7e741a9ccb4e5ad04ced22562b49c","lane":"client-lint","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":10,"stamp":"79ab06f4c1a0e5566d75134937990b58","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Ci-Attestation: {"at":1795317301,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"e139090ec62d22b66b695b962fddca983d7859f8823bb2f0ad2302ae96b4d348","lane":"client-test-x86_64-unknown-linux-gnu","parents":["7e17e738386d224416e7acd8d5de78b7d9065171"],"secs":202,"stamp":"4b67bd45d092841f24de830133d78784","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833","v":1,"via":"run"} Client-Checks: {"checks":{"base":"ec9208d1cd391d5f052dc510b7dc252a43bc75d5","coverage":"all-tracked-applicable-files","diff":["frontend/dialogs/OBSFallbackWarning.cpp.hpp","frontend/dialogs/OBSFallbackWarning.hpp","libobs/build/libobs.core+.h.c","libobs/build/libobs.ported-get-video+.h.c","libobs/build/ported-source-sets/get-video.json","libobs/cmake/rust-exports.d/obs-core-get_video.txt","libobs/obs-get-video-fields.c.h","rust/README.md","rust/obs-c-oracle/oracle/get_video.c","rust/obs-core/src/ffi/get_video.rs","rust/obs-core/src/ffi/mod.rs","rust/obs-core/src/get_video.rs","rust/obs-core/src/lib.rs","rust/obs-core/tests/obs_core/get_video.rs","rust/obs-core/tests/obs_core/get_video_parity.rs","rust/obs-core/tests/obs_core/main.rs","test/cmocka/build/rust-static-support.json","test/cmocka/get-video-link-support.c","test/cmocka/test_fallback_warning_dialog.cpp"],"head":"ce6c78a684e25eb7401f393ce5af3278f46f9ff2","tools":{"orchestrator-python":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]","schema-dependencies":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504-GITv2.15.4\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Regexps Automata RelaxNG Schemas Schematron Modules Debug Zlib"},"tracked-digest":"aec838430e0d92054fdaaa8f6b51136b25c9dcc90d5d79efbb2c0e35399ee453","tree":"b0e14e850ae6abb89dc4e678c95a42f774559833"}}
rdoupe
enabled auto-merge
November 22, 2026 03:15
zackees
approved these changes
Nov 22, 2026
zackees
left a comment
Member
There was a problem hiding this comment.
Coordinator review: approved.
- Matches the #3908 decision. The dialog gets an optional clock, empty by default. Real callers (
FallbackWarning.cpp.hpp) pass nothing, and the default path is equivalent to the old code:now()reads theQElapsedTimerstarted in the constructor, andnow() - lastTickis whatclock.restart()returned. Countdown length, tick interval, auto-accept, the exactly-once ending and the modal-pause discard (the step is still computed before the modal check) are unchanged.OBSFallbackWarning.hppis a frontend header, not a public C header. - The test:
- A manual clock, plus waits on events with a 30 s bound that only turns a hang into a failure, so no countdown races wall time.
- Every dialog read checks the
QPointerfirst. Shownmoved into setup and teardown, so a failed assertion leaks nothing.- Every existing assertion is kept, and the new
countdown_accepts_once_on_real_timecovers the default clock.
- Evidence: the RED scratch stall gives SIGSEGV plus the 180-byte leak on master, and passes on this branch. 10/10 under ASan, and 100/100 under full-core load.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3908
test_fallback_warning_dialograced its own countdowns against wall time.countdown_moves_the_progressshowed a 2000 ms countdown, waited 400 ms, then reads.dialog->findChild(...)without checking theQPointer. A runner that stalls for 2 s or more inside that wait lets the countdown finish, the dialog deletes itself, and the read dereferences null. cmocka then leaves the test by longjmp, skipping the destructor of the stackShown, which is the 180-byte LeakSanitizer report in #3871. The button, Escape, close and modal-pause cases had the same race against 300-400 ms countdowns.This is the fixture correction decided on the issue (2026-11-21): a test-only change to a test we wrote for the C++-only dialog (#2238), not an accommodation of a Rust port.
Change
OBSFallbackWarningtakes an optionalClock(monotonic ms). Empty, which is whatfrontend/utility/FallbackWarning.cpp.hpppasses, it starts itsQElapsedTimeras before.tick()computes the same step asclock.restart()did, before the modal check, so time spent behind another modal dialog is still discarded. Countdown length, tick interval, auto-accept and exactly-once ending are unchanged.advance()moves it, and the test waits on events (QTest::qWaitForwith a 30 s bound that only turns a hang into a failure), so no countdown can expire before the test lets it.Shownis allocated in cmocka setup and freed in teardown, so a failed assertion leaks nothing.countdown_accepts_once_on_real_time: the default clock still counts down and accepts once. It waits for the end instead of timing it.Every existing assertion is kept.
Evidence
The test built on its own (host Qt 6,
-fsanitize=address,QT_QPA_PLATFORM=offscreen, same two sources as itstest-graph.jsonentry).RED (origin/master
7e17e7383, a scratchQTest::qWait(2500)aftersettle(400)incountdown_moves_the_progress, not committed):GREEN, the same scratch stall after
advance(s, 400)in the new test:Full suite, unmodified: 10 of 10 pass under ASan with no leak report. 100 consecutive runs of the whole suite while 16 busy loops held all 16 cores: 100/100 passed (a shell loop over the binary, stopping at the first non-zero exit).
./lintpasses.🤖 Generated with Claude Code