Skip to content

UI: Keep weak stream output ref in status bar - #10680

Merged
RytoEX merged 1 commit into
obsproject:masterfrom
RytoEX:keep-weak-output-ref-status-bar
May 17, 2024
Merged

RytoEX merged 1 commit into
obsproject:masterfrom
RytoEX:keep-weak-output-ref-status-bar

Conversation

@RytoEX

@RytoEX RytoEX commented May 15, 2024

Copy link
Copy Markdown
Member

Description

The status bar doesn't currently own its references to outputs, which can be a problem if streaming outputs are released soon after stream stop. The Multitrack Video output does exactly that, so the status bar will sometimes try to access an invalid pointer for updating its stats. Keeping a weak reference around and upgrading it to collect stats, similar to how the stats window behaves.

Motivation and Context

Picked from #10633. Want to pull some commits out of that PR to make that PR smaller.

How Has This Been Tested?

This has been tested in the Twitch Enhanced Broadcasting beta.

Types of changes

  • Tweak (non-breaking change to improve existing functionality)
  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@RytoEX RytoEX added kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. kind/cleanup Non-breaking change which makes code smaller or more readable labels May 15, 2024
@RytoEX RytoEX added this to the OBS Studio (Next Version) milestone May 15, 2024
@RytoEX RytoEX self-assigned this May 15, 2024
@RytoEX

RytoEX commented May 15, 2024

Copy link
Copy Markdown
Member Author

If pulling commits out of #10633 isn't helpful, we can close this. I find it easier to review small PRs and had offered to start pulling commits out of that PR, so I wanted to start working towards that.

@sebastian-s-beckmann sebastian-s-beckmann left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems sane. If we’re not holding a strong reference we should not access the pointer (and if we were holding one we should listen to the appropriate signals to release it).

That said, this same thing should probably be applied to recordOutput too (even if it’s not causing crashes right now). I’d even consider this in-scope for this PR seeing how similar it is.

Comment thread UI/window-basic-status-bar.cpp Resolved
@cg2121

cg2121 commented May 16, 2024

Copy link
Copy Markdown
Contributor

If you are doing this for the streaming output, you should also do the recording output.

Comment thread UI/window-basic-status-bar.hpp Resolved
Comment thread UI/window-basic-status-bar.cpp Resolved
@RytoEX

RytoEX commented May 16, 2024 •

Copy link
Copy Markdown
Member Author

Regarding the recording output, while I initially had the same thought, the original commit in #10633 only addresses streaming output. I don't want to expand scope too much. I just want to trim down that PR. I can make a follow-up PR for recording output later.

@RytoEX
RytoEX force-pushed the keep-weak-output-ref-status-bar branch from d93a2fa to 835b746 Compare May 16, 2024 18:58
The status bar doesn't currently own its references to outputs, which
can be a problem if streaming outputs are released soon after stream
stop. The Multitrack Video output does exactly that, so the status bar
will sometimes try to access an invalid pointer for updating its stats.
Keeping a weak reference around and upgrading it to collect stats,
similar to how the stats window behaves.
@RytoEX
RytoEX force-pushed the keep-weak-output-ref-status-bar branch from 835b746 to 8d6d7e2 Compare May 17, 2024 17:26
@RytoEX
RytoEX merged commit a18305d into obsproject:master May 17, 2024
@RytoEX
RytoEX deleted the keep-weak-output-ref-status-bar branch May 17, 2024 17:48
@RytoEX RytoEX mentioned this pull request May 17, 2024
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Non-breaking change which makes code smaller or more readable kind/enhancement Enhancements are not bugs or new features but can improve usability or performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants