fix: Remove all screen picker listeners on listen to prevent leak
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
This commit is contained in:
parent
403e069a22
commit
5ddd5a9343
|
|
@ -197,9 +197,6 @@ export function createMainWindow() {
|
|||
.then((sources) => {
|
||||
// Shortcut for linux wayland.
|
||||
if (sources.length == 1) {
|
||||
// Clear out the IPC listener
|
||||
mainWindow.webContents.send("screenpicker", []);
|
||||
|
||||
// TODO: Get audio to work with wayland
|
||||
// See vencord for an implementation using a virtual microphone.
|
||||
callback({
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ contextBridge.exposeInMainWorld("native", {
|
|||
|
||||
setBadgeCount: (count: number) => ipcRenderer.send("setBadgeCount", count),
|
||||
|
||||
// Wrapped in braces to return void
|
||||
onceScreenPicker: (
|
||||
onScreenPick: (
|
||||
sources: {
|
||||
|
|
@ -27,7 +26,9 @@ contextBridge.exposeInMainWorld("native", {
|
|||
}[],
|
||||
) => void,
|
||||
) => {
|
||||
ipcRenderer.once("screenPicker", (_, sources) => onScreenPick(sources));
|
||||
const eventName = "screenPicker";
|
||||
ipcRenderer.removeAllListeners(eventName);
|
||||
ipcRenderer.once(eventName, (_, sources) => onScreenPick(sources));
|
||||
},
|
||||
screenPickerCallback: (idx: number, audio: boolean) =>
|
||||
ipcRenderer.send("screenPickerCallback", idx, audio),
|
||||
|
|
|
|||
Loading…
Reference in New Issue