mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-07-02 11:55:51 +08:00
[fix] harden macOS screen capture lifecycle against late callbacks
This commit is contained in:
@@ -16,7 +16,11 @@ int ScreenCapturerSck::Init(const int fps, cb_desktop_data cb) {
|
||||
}
|
||||
|
||||
screen_capturer_sck_impl_ = CreateScreenCapturerSck();
|
||||
screen_capturer_sck_impl_->Init(fps, on_data_);
|
||||
const int ret = screen_capturer_sck_impl_->Init(fps, on_data_);
|
||||
if (ret != 0) {
|
||||
screen_capturer_sck_impl_.reset();
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -29,8 +33,11 @@ int ScreenCapturerSck::Destroy() {
|
||||
}
|
||||
|
||||
int ScreenCapturerSck::Start(bool show_cursor) {
|
||||
screen_capturer_sck_impl_->Start(show_cursor);
|
||||
return 0;
|
||||
if (!screen_capturer_sck_impl_) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return screen_capturer_sck_impl_->Start(show_cursor);
|
||||
}
|
||||
|
||||
int ScreenCapturerSck::Stop() {
|
||||
@@ -80,4 +87,4 @@ std::vector<DisplayInfo> ScreenCapturerSck::GetDisplayInfoList() {
|
||||
void ScreenCapturerSck::OnFrame() {}
|
||||
|
||||
void ScreenCapturerSck::CleanUp() {}
|
||||
} // namespace crossdesk
|
||||
} // namespace crossdesk
|
||||
|
||||
Reference in New Issue
Block a user