fixed crash when cancelling screenshare
This commit is contained in:
parent
691997da12
commit
5001300a3b
2 changed files with 9 additions and 5 deletions
|
@ -52,9 +52,12 @@ export function registerScreenShareHandler() {
|
||||||
if (isWayland) {
|
if (isWayland) {
|
||||||
const video = data[0];
|
const video = data[0];
|
||||||
if (video)
|
if (video)
|
||||||
await request.frame.executeJavaScript(
|
var stream = await request.frame
|
||||||
`Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify([video])}, true)`
|
.executeJavaScript(
|
||||||
);
|
`Vesktop.Components.ScreenShare.openScreenSharePicker(${JSON.stringify([video])}, true)`
|
||||||
|
)
|
||||||
|
.catch(() => null);
|
||||||
|
if (stream === null) return callback({});
|
||||||
|
|
||||||
callback(video ? { video: sources[0] } : {});
|
callback(video ? { video: sources[0] } : {});
|
||||||
return;
|
return;
|
||||||
|
@ -71,6 +74,7 @@ export function registerScreenShareHandler() {
|
||||||
if (!choice) return callback({});
|
if (!choice) return callback({});
|
||||||
|
|
||||||
const source = sources.find(s => s.id === choice.id);
|
const source = sources.find(s => s.id === choice.id);
|
||||||
|
|
||||||
if (!source) return callback({});
|
if (!source) return callback({});
|
||||||
|
|
||||||
const streams: Streams = {
|
const streams: Streams = {
|
||||||
|
|
|
@ -71,7 +71,7 @@ addPatch({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export function openScreenSharePicker(screens: Source[], skipPicker: boolean) {
|
export async function openScreenSharePicker(screens: Source[], skipPicker: boolean) {
|
||||||
let didSubmit = false;
|
let didSubmit = false;
|
||||||
return new Promise<StreamPick>((resolve, reject) => {
|
return new Promise<StreamPick>((resolve, reject) => {
|
||||||
const key = openModal(
|
const key = openModal(
|
||||||
|
@ -98,7 +98,7 @@ export function openScreenSharePicker(screens: Source[], skipPicker: boolean) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
}).catch(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ScreenPicker({ screens, chooseScreen }: { screens: Source[]; chooseScreen: (id: string) => void }) {
|
function ScreenPicker({ screens, chooseScreen }: { screens: Source[]; chooseScreen: (id: string) => void }) {
|
||||||
|
|
Reference in a new issue