-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
obs-browser: prevent race condition in CEF paint pipeline #138
base: master
Are you sure you want to change the base?
Conversation
* WasHidden & CloseBrowser are now called before bc->bs is dereferenced to disable calls to GetViewRect(), OnPaint() & OnAcceleratedPaint() earlier. * WasHidden, CloseBrowser, Invalidate, SendProcessMessage are now called on the current thread: execution on CEF UI thread is not required for those calls. * In CEF paint pipeline (GetViewRect, OnPaint, OnAcceleratedPaint): Save the value of bc->bs befpre checking if it's valid to prevent the condition where bc->bs is checked for validity and immediately invalidated in a parallel thread.
This PR resolves the following crash.
|
@@ -96,7 +96,9 @@ bool BrowserClient::OnProcessMessageReceived( | |||
const std::string &name = message->GetName(); | |||
Json json; | |||
|
|||
if (!bs) { | |||
BrowserSource* source = bs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of doing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen crashes in the wild where !bs
check was completed successfully but crashes downstream on bs->
usage. This suggests bs
might be invalidated in a parallel thread right after the !bs
check completed.
Is this still a problem with the current codebase and modern CEF builds? |
dereferenced to disable calls to GetViewRect(), OnPaint() &
OnAcceleratedPaint() earlier.
are now called on the current thread: execution on CEF UI thread
is not required for those calls.
Save the value of bc->bs befpre checking if it's valid to prevent the
condition where bc->bs is checked for validity and immediately
invalidated in a parallel thread.