8000 fix: memory leak in desktopCapturer.getSources by miniak · Pull Request #27506 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: memory leak in desktopCapturer.getSources #27506

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

Merged
merged 1 commit into from
Jan 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/browser/desktop-capturer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const getSources = (event: Electron.IpcMainEvent, options: ElectronIntern
}
// Remove from currentlyRunning once we resolve or reject
currentlyRunning = currentlyRunning.filter(running => running.options !== options);
event.sender.removeListener('destroyed', stopRunning);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

event cannot be null in this branch, compared to master

};

const emitter = new EventEmitter();
Expand All @@ -54,7 +55,7 @@ export const getSources = (event: Electron.IpcMainEvent, options: ElectronIntern
// If the WebContents is destroyed before receiving result, just remove the
// reference to emit and the capturer itself so that it never dispatches
// back to the renderer
event.sender.once('destroyed', () => stopRunning());
event.sender.once('destroyed', stopRunning);
});

currentlyRunning.push({
Expand Down
0