Compare commits

...

2 commits

Author SHA1 Message Date
Daniel
1da6c76017 fix(electron): crash when cancelling screen picker
Some checks are pending
Build & Deploy / build (push) Waiting to run
Build & Deploy / deploy (push) Blocked by required conditions
Build & Deploy / bump-version (push) Blocked by required conditions
Calling callback({}) with an empty object caused Electron to throw
"Video was requested, but no video stream was provided". The correct
way to cancel/deny the request is callback() with no arguments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 23:06:54 +01:00
Forgejo CI
694f4371ce v1.8.15 [skip ci] 2026-03-10 21:40:14 +00:00
2 changed files with 5 additions and 5 deletions

View file

@ -1 +1 @@
1.8.14 1.8.15

View file

@ -134,7 +134,7 @@ function createWindow() {
session.defaultSession.setDisplayMediaRequestHandler(async (_request, callback) => { session.defaultSession.setDisplayMediaRequestHandler(async (_request, callback) => {
const sources = await desktopCapturer.getSources({ types: ['screen', 'window'], thumbnailSize: { width: 320, height: 180 } }); const sources = await desktopCapturer.getSources({ types: ['screen', 'window'], thumbnailSize: { width: 320, height: 180 } });
if (sources.length === 0) { if (sources.length === 0) {
callback({}); callback();
return; return;
} }
@ -232,7 +232,7 @@ document.getElementById('cancelBtn').addEventListener('click', () => {
try { fs.unlinkSync(tmpFile); } catch {} try { fs.unlinkSync(tmpFile); } catch {}
if (!selection) { if (!selection) {
callback({}); callback();
return; return;
} }
const selectedId = typeof selection === 'string' ? selection : selection.id; const selectedId = typeof selection === 'string' ? selection : selection.id;
@ -241,7 +241,7 @@ document.getElementById('cancelBtn').addEventListener('click', () => {
if (chosen) { if (chosen) {
callback(withAudio ? { video: chosen, audio: 'loopback' } : { video: chosen }); callback(withAudio ? { video: chosen, audio: 'loopback' } : { video: chosen });
} else { } else {
callback({}); callback();
} }
}; };
@ -252,7 +252,7 @@ document.getElementById('cancelBtn').addEventListener('click', () => {
if (!resolved) { if (!resolved) {
resolved = true; resolved = true;
ipcMain.removeListener(PICKER_CHANNEL, onPickerResult); ipcMain.removeListener(PICKER_CHANNEL, onPickerResult);
callback({}); callback();
} }
}); });
}); });