Do not try to create the browser before init #519
Labels
No labels
area/accessibility
area/dependency
Confirmed
Crash Report
Delayed
Design Issue
Duplicate
Feedback required
Good first issue
kind/bug
kind/cleanup
kind/enhancement
platform/linux
platform/macos
platform/windows
priority/high
Question
Request for Comments
Seeking Other Contributors
Seeking Testers
Won't Fix / By Design
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-obsproject/obs-browser!519
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-init-race"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Should fix the random asserts on startup (not related to the recent consistent startup failures), I think.
Motivation and Context
Fixes a race.
How Has This Been Tested?
Quick smoke test.
Types of changes
Checklist:
What's the actual root cause of the race? At first glance the "browser manager thread" seems like a culprit, because it decouples the actual initialisation of CEF from the main thread on Windows and Linux (but not on macOS), so CEF will only be initialised "eventually".
On macOS
BrowserInitalways finishes beforeobs_browser_initializereturns, so I guess we don't face the same issue there?Yes, it's that. In particular, the graphics thread will call tick on the source once it's added to the scene, and if CEF init isn't complete yet by then bad things happen.
Annoying that it's necessary, but seems like the most elegant fix for this race condition.
Please amend the commit description per our contribution guidelines to explain the "why" of the fix (explaining the race condition, it's root cause, and why this fixes it).
Done.
Sorry, should've picked up on this in my earlier preview. Per our code style guidelines, except for C code, we prefer all conditional and loop blocks to be explicitly enclosed with curlies.
I mean... sure but... nothing else in the file does this, including the rest of the function.
I think if this is desired, someone should add
InsertBraces: trueto .clang-format and fix the whole codebase. Enforcing things like this in review is essentially a waste of everyone's time when clang-format can do it for you.Historically, we have avoided this because it would be disruptive to all open PRs. However, we have decided that there is no good time for this, so we will be enforcing braces via clang-format in the near future.