Skip to content

Queue navigation in browser dock to fix deadlock - #556

Merged
RytoEX merged 1 commit into
obsproject:masterfrom
WizardCM:fix-youtube-login-deadlock
Oct 27, 2026
Merged

RytoEX merged 1 commit into
obsproject:masterfrom
WizardCM:fix-youtube-login-deadlock

Conversation

@WizardCM

Copy link
Copy Markdown
Member

Description

Queue navigation of browser docks.

Motivation and Context

Qt and CEF like to fight each other's queues.

Fixes a deadlock when attempting to log into YouTube Service Integration.

Fix found by @prgmitchell and verified by both Mitchell and myself.

How Has This Been Tested?

Log into YouTube account on macOS.

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.

@WizardCM WizardCM added the kind/bug Categorizes issue or PR as related to a bug. label Oct 24, 2026
@PatTheMav

Copy link
Copy Markdown
Member

I wonder if it would also be good to schedule the call to reload the page in YoutubeAuth::ReloadChat on the main event loop as well as that one is the root cause of the issue:

  • The YouTube app dock changes URL and opportunistically always triggers a reload of the chat dock, just in case that a YouTube login took place
  • This means that a navigation event in the chat dock is triggered while handling the navigation event in the app dock
  • Both locks attempt to get a lock on the global(!) mutex used by QCefWidget, and thus the deadlock occurs

In general we need to detach code that runs as part of the browser event loop or handles a browser event from code that runs as part of the main event loop, so that the "current" event handler can always finish and does not nest events within events.

@github-project-automation github-project-automation Bot moved this from Ready For Review to Ready For Merge in Current Release Tracker (33.0) Oct 26, 2026
@PatTheMav

Copy link
Copy Markdown
Member

You might want to add the following as motivation/context to the commit message:

The current YouTube dock implementation uses a urlChanged event as the trigger to refresh the chat dock opportunistically, as authentication cookies might now be present and the chat dock could end up in a "logged-in" state.

This reload itself will trigger the onBeforeBrowse event handler however, which then attempts to acquire the global lock held by the outer onBeforeBrowse handler and thus deadlocks the application.

Deferring the urlChanged event to the next iteration of the event loop allows onBeforeBrowse to finish to completion and release the lock.

The current YouTube dock implementation uses a `urlChanged` event as the
trigger to refresh the chat dock opportunistically, as authentication
cookies might now be present and the chat dock could end up in a
"logged-in" state.

This reload itself will trigger the `onBeforeBrowse` event handler
however, which then attempts to acquire the global lock held by the
outer `onBeforeBrowse` handler and thus deadlocks the application.

Deferring the `urlChanged` event to the next iteration of the event loop
allows `onBeforeBrowse` to finish to completion and release the lock.
@RytoEX
RytoEX force-pushed the fix-youtube-login-deadlock branch from f0151c9 to eb05639 Compare October 27, 2026 17:09
@RytoEX
RytoEX merged commit 7962467 into obsproject:master Oct 27, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Ready For Merge to Merged in Current Release Tracker (33.0) Oct 27, 2026
@WizardCM WizardCM linked an issue Oct 27, 2026 that may be closed by this pull request
@WizardCM
WizardCM deleted the fix-youtube-login-deadlock branch November 3, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug.

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

after adding items to dock it's unresponsive

3 participants