Skip to content

Commit

Permalink
CGWindowListScreenCapturer — michelf#23 Move unhideOnNextDisplay to a…
Browse files Browse the repository at this point in the history
… single queue
  • Loading branch information
importRyan committed Aug 23, 2021
1 parent f086d0a commit 7bf5c79
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Metal/ScreenCapture/CGWindowListScreenCapturer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,8 @@ private extension CGWindowListScreenCapturer {

func afterCapturingUnhideOnNextDisplayIfNeeded() {
guard unhideOnNextDisplay else { return }
unhideOnNextDisplay = false
DispatchQueue.main.async { [weak self] in
// recheck, because the state could have changed since the dispatch
guard self?.unhideOnNextDisplay == true else { return }
self?.unhideOnNextDisplay = false
self?.view?.isHidden = false
}
}
Expand Down Expand Up @@ -254,7 +252,9 @@ private extension CGWindowListScreenCapturer {
if let link = displayLink { CVDisplayLinkStart(link) }
capturingDisabled = false
captureImmediately()
unhideOnNextDisplay = true
queue?.async { [weak self] in
self?.unhideOnNextDisplay = true
}
}
}
}
Expand Down

0 comments on commit 7bf5c79

Please sign in to comment.