Skip to content

frontend: Remove the mixer and stats event callbacks only once - #425

Merged
zackees merged 1 commit into
masterfrom
fix/156-frontend-callback-teardown
Oct 13, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/156-frontend-callback-teardown

Conversation

@zackees

@zackees zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member

Closes #156.

Every normal shutdown logged Tried to call obs_frontend_remove_event_callback with no callbacks!. OBSBasic::closeWindow sends OBS_FRONTEND_EVENT_EXIT and then tears down the frontend API. AudioMixer removes its callback on EXIT, then ~AudioMixer removed it again unconditionally, after the API was gone. OBSBasicStats has the same shape (EXIT, then closeEvent).

Fix: each widget sets frontendEventCallbackAdded when it registers and removes through removeFrontendEventCallback(), which does nothing once removed. The EXIT path and the later destructor or closeEvent path therefore remove it exactly once.

No RED test: these are Qt widgets torn down inside OBSBasic::closeWindow, and there is no Qt-free seam to unit test without a much larger refactor. Verification is this PR's full OBS builds (Linux, macOS, Windows, Flatpak) plus checking a launch/quit log for the message. The local gate (lint, Rust, Tier 2) passed and is stamped, but it doesn't compile the frontend.

AudioMixer and OBSBasicStats remove their frontend event callback on
OBS_FRONTEND_EVENT_EXIT. After that the frontend API is torn down, and
~AudioMixer (and a stats closeEvent during teardown) removed it again,
logging "Tried to call obs_frontend_remove_event_callback with no
callbacks!" on every shutdown. Each now tracks whether its callback is
still registered.

Closes #156

Local-Gate: v1 tree=75ee54f1cc693d8a76dcf57818d445b665f9d974 secs=136 lanes=lint:run,rust-test:run,tier2-linux:run
Ci-Attestation: {"at":1791855255,"gate":"rust/all/fmt","host":"linux-x86_64","key":"d5ef385dec9b77f245096268caa8cf3ba003a35ea9b8510b53a8b1e827f3c664","lane":"lint","parents":["487c90c44ffb91e59baa6dd5304688309f8ac2d4"],"secs":18,"stamp":"4c952c88ed49a589f1623139e1ac9bf0","tree":"75ee54f1cc693d8a76dcf57818d445b665f9d974","v":1,"via":"run"}
Ci-Attestation: {"at":1791855255,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"d5ef385dec9b77f245096268caa8cf3ba003a35ea9b8510b53a8b1e827f3c664","lane":"lint","parents":["487c90c44ffb91e59baa6dd5304688309f8ac2d4"],"secs":18,"stamp":"5866864ddb3102c4b8d46907acdd9454","tree":"75ee54f1cc693d8a76dcf57818d445b665f9d974","v":1,"via":"run"}
Ci-Attestation: {"at":1791855255,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"2c91e1e6f4f042c13e72f986474cd72635e1b9083b364557404f15c285c34f16","lane":"rust-test","parents":["487c90c44ffb91e59baa6dd5304688309f8ac2d4"],"secs":50,"stamp":"2057a90f5d285518b3ea23a01edc5ffd","tree":"75ee54f1cc693d8a76dcf57818d445b665f9d974","v":1,"via":"run"}
Ci-Attestation: {"at":1791855255,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"0cbc7907366e3c5c4e6f5f8895cd586d2f69301fc889e5f32388cf71b67ebca2","lane":"tier2-linux","parents":["487c90c44ffb91e59baa6dd5304688309f8ac2d4"],"secs":68,"stamp":"39b850dcf8e440d1243ec9d80a8f16e4","tree":"75ee54f1cc693d8a76dcf57818d445b665f9d974","v":1,"via":"run"}
@zackees
zackees merged commit bbcfb43 into master Oct 13, 2026
23 checks passed
@zackees
zackees deleted the fix/156-frontend-callback-teardown branch October 26, 2026 15:43
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.

Frontend: obs_frontend_remove_event_callback called after frontend API teardown on every shutdown

1 participant