Skip to content

frontend: Sort the Add Source existing sources by name - #605

Merged
zackees merged 3 commits into
obs-rust:masterfrom
rdoupe:fix/source-select-sort
Oct 13, 2026
Merged

zackees merged 3 commits into
obs-rust:masterfrom
rdoupe:fix/source-select-sort

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Description

The Add Source dialog lists the existing sources of a type by name again (ignoring case), as before 32.2. Since the new dialog in 32.2 they were listed in creation order. The Recently Added list keeps its order (newest first).

  1. frontend: Move the Add Source existing-source filter into a helper: moves the filter in updateExistingSources() into SourceSelectExistingList() (frontend/utility/source-select-list.cpp, Qt Core only) so it can be tested without the dialog. No change in behaviour.

  2. test/cmocka: Add Source lists a type's existing sources unsorted: test_source_select_list creates real libobs sources of two dummy input types out of alphabetical order (Zeta, alpha, Mike, beta, Charlie, mixed with another type) and asks the helper for one type's list. The cases are:

    • a type's sources come back sorted by name, ignoring case;
    • guard: Recently Added keeps creation order;
    • guard: removed sources are not listed.

    1 of 3 fails today (the guards pass), the same way in every run: the list comes back as "Zeta, alpha, Mike, beta, Charlie".

  3. frontend: Sort the Add Source existing sources by name: the fix, a port of Warchamp7's frontend: Sort add source list alphabetically obsproject/obs-studio#13952 (credited as co-author). Differences: each name is read once before sorting, and the sort is stable, so a source that disappears while the list is built cannot break the comparison. 3 of 3 pass.

Motivation and Context

Fixes #604 (upstream obsproject/obs-studio#13947, reported by tiberium-v; labelled as a regression and confirmed upstream). Warchamp7 explains in #13952 that the old dialog's QListWidget had sorting enabled, which is why the list used to be alphabetical; that PR is not merged yet.

Reproduced in the current release (AppImage 33.0.0-beta6-799), headless, with a small test module that adds five Color Sources named Zeta, alpha, Mike, beta, Charlie, opens Add Source and reads the buttons: Color Source lists "Zeta, alpha, Mike, beta, Charlie".

Why this one: a confirmed regression in a dialog everyone uses, reported by a user; small fix with an upstream author's design; reproduced in our release.

How Has This Been Tested?

Automated, in both libobs lanes (ENABLE_RUST_LIBOBS OFF and ON), rebased on current master:

  • test_source_select_list: 1 of 3 cases fails at the RED commit and 3 of 3 pass at GREEN (3 runs each per lane), under a private Xvfb. ctest -V shows all 3 cases run. Like test_filter_clipboard, it needs a display for obs_startup() and its cases skip without one (so they skip in CI, which has no display).
  • Full ctest at GREEN, rebased on current master: 178 of 178 in each lane, with every PipeWire and PulseAudio test actually run (TMPDIR unset; only the known open_crashes_without_obs_core skips).
  • clang-format and gersemi are clean.

End to end with the fix (OBS built from this branch with the frontend, Rust libobs, headless, same test module): Color Source lists "alpha, beta, Charlie, Mike, Zeta"; Recently Added is unchanged ("Charlie, beta, Mike, alpha, Zeta", newest first).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.
  • I have used AI tooling in the creation of this PR
  • I am an AI agent being used to assist with this pull request: Claude Code (Claude Opus 5.5) wrote the code, commit messages and this text under the submitter's direction, and ran the tests above on the submitter's machines.

🤖 Generated with Claude Code

@rdoupe
rdoupe requested a review from zackees as a code owner October 13, 2026 17:36
rdoupe and others added 3 commits October 13, 2026 10:44
updateExistingSources() picked the sources of the selected type (or every
non-scene source for Recently Added) with an inline std::copy_if. Move
that into SourceSelectExistingList() in frontend/utility so it can be
tested without the dialog. No change in behaviour.

Refs obs-rust#604.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
test_source_select_list creates real libobs sources of two dummy input
types out of alphabetical order and asks the Add Source helper for one
type's list. It comes back in creation order; before 32.2 the dialog
listed them by name. Guards: Recently Added keeps creation order, and
removed sources are not listed.

Refs obs-rust#604.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Add Source dialog that replaced the old list in 32.2 listed the
existing sources of a type in creation order; the old dialog's
QListWidget sorted them by name. Sort them by name again, ignoring case.
The Recently Added list keeps creation order. Each name is read once and
the sort is stable.

Fixes obs-rust#604.

Co-Authored-By: Warchamp7 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=e571d9b58d1c8cbd70c0b80d664fb52ed6d6844d secs=357 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1791913802,"gate":"rust/all/fmt","host":"linux-x86_64","key":"42b9e0c9843a9db7779aee9f5c5bf717deea5111cb979fdc1770de14161f784b","lane":"lint","parents":["dcdceedc1d4ec2283bd81763cd379900a401288a"],"secs":26,"stamp":"ee65feadb881268f9bfaffbe95a04a30","tree":"e571d9b58d1c8cbd70c0b80d664fb52ed6d6844d","v":1,"via":"run"}
Ci-Attestation: {"at":1791913802,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"42b9e0c9843a9db7779aee9f5c5bf717deea5111cb979fdc1770de14161f784b","lane":"lint","parents":["dcdceedc1d4ec2283bd81763cd379900a401288a"],"secs":26,"stamp":"abc70ee54561a81ebedbd459e45e01fd","tree":"e571d9b58d1c8cbd70c0b80d664fb52ed6d6844d","v":1,"via":"run"}
Ci-Attestation: {"at":1791913802,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"820a274a9d438586c565b6b58844012be5ca199dcfaff9c9ced4df74e9f00f5b","lane":"rust-test","parents":["dcdceedc1d4ec2283bd81763cd379900a401288a"],"secs":115,"stamp":"2a7e194af0cb4e49ae8a951058cb22bc","tree":"e571d9b58d1c8cbd70c0b80d664fb52ed6d6844d","v":1,"via":"run"}
Ci-Attestation: {"at":1791913802,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"cde0a8459f6427971bbaa49015fd1b9a80443d24f4cf1ce9c4d012d85faf305c","lane":"cross","parents":["dcdceedc1d4ec2283bd81763cd379900a401288a"],"secs":92,"stamp":"4ad044929908f0fe1c90ae249c297770","tree":"e571d9b58d1c8cbd70c0b80d664fb52ed6d6844d","v":1,"via":"run"}
Ci-Attestation: {"at":1791913802,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"cde0a8459f6427971bbaa49015fd1b9a80443d24f4cf1ce9c4d012d85faf305c","lane":"cross","parents":["dcdceedc1d4ec2283bd81763cd379900a401288a"],"secs":92,"stamp":"c95a5c77253ca7993228c57212273f72","tree":"e571d9b58d1c8cbd70c0b80d664fb52ed6d6844d","v":1,"via":"run"}
Ci-Attestation: {"at":1791913802,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"cde0a8459f6427971bbaa49015fd1b9a80443d24f4cf1ce9c4d012d85faf305c","lane":"cross","parents":["dcdceedc1d4ec2283bd81763cd379900a401288a"],"secs":92,"stamp":"d1737b126ea0133cbbc648d74775c645","tree":"e571d9b58d1c8cbd70c0b80d664fb52ed6d6844d","v":1,"via":"run"}
Ci-Attestation: {"at":1791913802,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"cde0a8459f6427971bbaa49015fd1b9a80443d24f4cf1ce9c4d012d85faf305c","lane":"cross","parents":["dcdceedc1d4ec2283bd81763cd379900a401288a"],"secs":92,"stamp":"62c41366ab4567a12c08b779f322137c","tree":"e571d9b58d1c8cbd70c0b80d664fb52ed6d6844d","v":1,"via":"run"}
Ci-Attestation: {"at":1791913802,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"cde0a8459f6427971bbaa49015fd1b9a80443d24f4cf1ce9c4d012d85faf305c","lane":"cross","parents":["dcdceedc1d4ec2283bd81763cd379900a401288a"],"secs":92,"stamp":"bb220c873ef846dcbf1d7321f5e3ecb7","tree":"e571d9b58d1c8cbd70c0b80d664fb52ed6d6844d","v":1,"via":"run"}
Ci-Attestation: {"at":1791913802,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"cde0a8459f6427971bbaa49015fd1b9a80443d24f4cf1ce9c4d012d85faf305c","lane":"cross","parents":["dcdceedc1d4ec2283bd81763cd379900a401288a"],"secs":92,"stamp":"85de2e5d16f9f8743d03b7f278d2d61a","tree":"e571d9b58d1c8cbd70c0b80d664fb52ed6d6844d","v":1,"via":"run"}
Ci-Attestation: {"at":1791913802,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"be928132e7e7e4a43c1b61246b6c7faa063c83e8ab81d43fd6fc1451cf648d1a","lane":"tier2-linux","parents":["dcdceedc1d4ec2283bd81763cd379900a401288a"],"secs":124,"stamp":"261d59c3e5cb257e5412e5a74881c391","tree":"e571d9b58d1c8cbd70c0b80d664fb52ed6d6844d","v":1,"via":"run"}
@zackees

zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member

Verified locally under xvfb-run (Tier 2 image + mesa):

  • RED 3916236: test_source_select_list fails type_list_is_sorted_by_name
  • GREEN 9bf6405: 3/3
  • OBSBasicSourceSelect.cpp is only compiled by CI's full build.
  • Rebased on master, local gate passed; pushed as cfce182.

@zackees
zackees force-pushed the fix/source-select-sort branch from 9bf6405 to cfce182 Compare October 13, 2026 17:50
@zackees
zackees merged commit 622fa01 into obs-rust:master Oct 13, 2026
19 checks passed
zackees added a commit to rdoupe/obs-studio that referenced this pull request Oct 13, 2026
cmocka.h defines inline for MSVC; the C++ standard library then stops with
C1189 (xkeycheck.h). test_preview_audio_sources (obs-rust#603) and
test_source_select_list (obs-rust#605) broke Rust Tier 2 on Windows.

Local-Gate: v1 tree=18171423214d0ff1f389335b7ecfa6dfaa2a3325 secs=318 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1791915462,"gate":"rust/all/fmt","host":"linux-x86_64","key":"a170de36a11c01c60ef4be85fbbb63c87b7c8f6fd7540f779537e6263ee47bb2","lane":"lint","parents":["622fa0150a5b5399fca6f70b5a9e119dcdc1b230"],"secs":26,"stamp":"94fd94970e6fe618a97da21fa028bca2","tree":"18171423214d0ff1f389335b7ecfa6dfaa2a3325","v":1,"via":"run"}
Ci-Attestation: {"at":1791915462,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"a170de36a11c01c60ef4be85fbbb63c87b7c8f6fd7540f779537e6263ee47bb2","lane":"lint","parents":["622fa0150a5b5399fca6f70b5a9e119dcdc1b230"],"secs":26,"stamp":"47fb7dc0fd63778a6c47af595688bd9c","tree":"18171423214d0ff1f389335b7ecfa6dfaa2a3325","v":1,"via":"run"}
Ci-Attestation: {"at":1791915462,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"a68a6419710723aa179271d9832becca610d83d890c16b635148e37896b4dd00","lane":"rust-test","parents":["622fa0150a5b5399fca6f70b5a9e119dcdc1b230"],"secs":80,"stamp":"26c6b571267af1df9c5fe47a801103bc","tree":"18171423214d0ff1f389335b7ecfa6dfaa2a3325","v":1,"via":"run"}
Ci-Attestation: {"at":1791915462,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"8907a8740d6482a11a2d098769993caa1a477d63e36066a5cc4b8f7fa4cc8764","lane":"cross","parents":["622fa0150a5b5399fca6f70b5a9e119dcdc1b230"],"secs":62,"stamp":"53ab1315bef740a3ed55ca1e69334be8","tree":"18171423214d0ff1f389335b7ecfa6dfaa2a3325","v":1,"via":"run"}
Ci-Attestation: {"at":1791915462,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"8907a8740d6482a11a2d098769993caa1a477d63e36066a5cc4b8f7fa4cc8764","lane":"cross","parents":["622fa0150a5b5399fca6f70b5a9e119dcdc1b230"],"secs":62,"stamp":"8d311426e90d4964c931bcfae1e81ef3","tree":"18171423214d0ff1f389335b7ecfa6dfaa2a3325","v":1,"via":"run"}
Ci-Attestation: {"at":1791915462,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"8907a8740d6482a11a2d098769993caa1a477d63e36066a5cc4b8f7fa4cc8764","lane":"cross","parents":["622fa0150a5b5399fca6f70b5a9e119dcdc1b230"],"secs":62,"stamp":"43d4fb522d7319c971b6724597570f28","tree":"18171423214d0ff1f389335b7ecfa6dfaa2a3325","v":1,"via":"run"}
Ci-Attestation: {"at":1791915462,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"8907a8740d6482a11a2d098769993caa1a477d63e36066a5cc4b8f7fa4cc8764","lane":"cross","parents":["622fa0150a5b5399fca6f70b5a9e119dcdc1b230"],"secs":62,"stamp":"aa343661a87b3008281e5a37b561926d","tree":"18171423214d0ff1f389335b7ecfa6dfaa2a3325","v":1,"via":"run"}
Ci-Attestation: {"at":1791915462,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"8907a8740d6482a11a2d098769993caa1a477d63e36066a5cc4b8f7fa4cc8764","lane":"cross","parents":["622fa0150a5b5399fca6f70b5a9e119dcdc1b230"],"secs":62,"stamp":"7497935565e024dddba340a5d2aa00c3","tree":"18171423214d0ff1f389335b7ecfa6dfaa2a3325","v":1,"via":"run"}
Ci-Attestation: {"at":1791915462,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"8907a8740d6482a11a2d098769993caa1a477d63e36066a5cc4b8f7fa4cc8764","lane":"cross","parents":["622fa0150a5b5399fca6f70b5a9e119dcdc1b230"],"secs":62,"stamp":"1a99834f286813ad454cf854cce18dd4","tree":"18171423214d0ff1f389335b7ecfa6dfaa2a3325","v":1,"via":"run"}
Ci-Attestation: {"at":1791915462,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"3dd1f4a787d118314f3cbeeaf0de9dedcf34351f267585947d794ea676b66a6a","lane":"tier2-linux","parents":["622fa0150a5b5399fca6f70b5a9e119dcdc1b230"],"secs":150,"stamp":"d84556bb2dee1e55ea8cf6bcd8c5a2dc","tree":"18171423214d0ff1f389335b7ecfa6dfaa2a3325","v":1,"via":"run"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: frontend: Add Source lists the existing sources of a type in creation order instead of by name (upstream obsproject/obs-studio#13947)

2 participants