Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(capture): build the macOS helper again, and own the cover's promise in its thread
EtienneLescotdd7c50043609
diff --git a/electron/native/screencapturekit/Sources/OpenScreenScreenCaptureKitHelper/PickerSession.swift b/electron/native/screencapturekit/Sources/OpenScreenScreenCaptureKitHelper/PickerSession.swiftindex 0ea5a281d..6b64fd2d5 100644--- a/electron/native/screencapturekit/Sources/OpenScreenScreenCaptureKitHelper/PickerSession.swift+++ b/electron/native/screencapturekit/Sources/OpenScreenScreenCaptureKitHelper/PickerSession.swift@@ -96,7 +96,7 @@ final class PickerSession: NSObject, SCContentSharingPickerObserver, @unchecked// the HUD and the notes window belong to Electron. Measured: a window owned by the// parent app shows in the capture unless it is listed here.configuration.excludedWindowIDs =- excludedWindowIDs + Self.desktopIconWindowIDs(hideDesktopIcons: hideDesktopIcons)+ excludedWindowIDs + Self.finderDesktopIconWindowIDs(hideDesktopIcons: hideDesktopIcons)// By app, not by window: a banner is a window created after the pick, so no id// list taken now could name it.configuration.excludedBundleIDs = [notificationCenterBundleID]@@ -174,7 +174,9 @@ final class PickerSession: NSObject, SCContentSharingPickerObserver, @unchecked/// need the Screen Recording grant the picker exists to avoid. Owner and level are/// readable without it. The icons stay put for the whole session, so ids taken at pick/// time hold -- unless Finder relaunches, which gives them new ones.- private static func desktopIconWindowIDs(hideDesktopIcons: Bool) -> [Int] {+ /// Not named `desktopIconWindowIDs`: inside this class that name would shadow the+ /// OpenScreenCaptureCore function it calls.+ private static func finderDesktopIconWindowIDs(hideDesktopIcons: Bool) -> [Int] {guard hideDesktopIcons,let entries = CGWindowListCopyWindowInfo([.optionOnScreenOnly], kCGNullWindowID)as? [[String: Any]]@@ -193,7 +195,7 @@ final class PickerSession: NSObject, SCContentSharingPickerObserver, @uncheckedlayer: entry[kCGWindowLayer as String] as? Int ?? 0)}- return desktopIconWindowIDs(candidates).map { Int($0) }+ return OpenScreenCaptureCore.desktopIconWindowIDs(candidates).map { Int($0) }}private static func display(containing frame: CGRect) -> CGDirectDisplayID? {diff --git a/electron/native/wgc-capture/src/desktop_icon_cover.cpp b/electron/native/wgc-capture/src/desktop_icon_cover.cppindex d82226dd3..1ebc59f95 100644--- a/electron/native/wgc-capture/src/desktop_icon_cover.cpp+++ b/electron/native/wgc-capture/src/desktop_icon_cover.cpp@@ -62,9 +62,11 @@ bool DesktopIconCover::show(HMONITOR monitor) {return false;}- std::promise<bool> placed;- std::future<bool> placedResult = placed.get_future();- thread_ = std::thread([this, rect = info.rcMonitor, &placed]() {+ // Moved into the thread, not captured by reference: `get()` can return before+ // `set_value` has finished with the promise, and this frame is gone by then.+ std::promise<bool> promise;+ std::future<bool> placedResult = promise.get_future();+ thread_ = std::thread([this, rect = info.rcMonitor, placed = std::move(promise)]() mutable {threadId_ = GetCurrentThreadId();HINSTANCE instance = GetModuleHandleW(nullptr);WNDCLASSEXW windowClass{sizeof(windowClass)};