-
Notifications
You must be signed in to change notification settings - Fork 16.3k
fix: DesktopCapturer gc'd prior to capture completion #28273
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
fix: DesktopCapturer gc'd prior to capture completion #28273
Conversation
desktopCapture.getSources() returns a promise which should resolve when capturing finishes. Internally it creates an instance of DesktopCapturer which is responsible for resolving or rejecting the promise. Between the time DesktopCapturer starts capturing frames and when it finishes, it's possible for its handle to be GC'd leading to it never resolving. These changes pin the instance of DesktopCapturer until it either finishes or errors. fixes electron#25595
Release Notes Persisted
|
I have automatically backported this PR to "10-x-y", please check out #28279 |
I have automatically backported this PR to "13-x-y", please check out #28280 |
I have automatically backported this PR to "12-x-y", please check out #28281 |
I have automatically backported this PR to "11-x-y", please check out #28282 |
Thank you so much for this, @samuelmaddock! |
Description of Change
desktopCapturer.getSources()
returns a promise which should resolvewhen capturing finishes. Internally it creates an instance of
DesktopCapturer which is responsible for resolving or rejecting
the promise.
Between the time DesktopCapturer starts capturing frames and when
it finishes, it's possible for its handle to be GC'd leading to
it never resolving.
These changes pin the instance of DesktopCapturer until it either
finishes or errors.
fixes #25595
To verify the fix, I ran this Fiddle gist which normally fails after 10-30 seconds without the fix
https://gist.github.com/90f43a52e7c48a531a57bec77428e11a
cc @codebytere
Checklist
npm test
passesRelease Notes
Notes: Fixed
desktopCapturer.getSources()
promise result sometimes never resolving.