mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 12:15:34 +08:00
Fix crash during termination on windows
This commit is contained in:
@@ -4,7 +4,12 @@
|
|||||||
|
|
||||||
MouseController::MouseController() {}
|
MouseController::MouseController() {}
|
||||||
|
|
||||||
MouseController::~MouseController() {}
|
MouseController::~MouseController() {
|
||||||
|
if (uinput_fd_) {
|
||||||
|
ioctl(uinput_fd_, UI_DEV_DESTROY);
|
||||||
|
close(uinput_fd_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int MouseController::Init(int screen_width, int screen_height) {
|
int MouseController::Init(int screen_width, int screen_height) {
|
||||||
screen_width_ = screen_width;
|
screen_width_ = screen_width;
|
||||||
@@ -41,13 +46,7 @@ int MouseController::Init(int screen_width, int screen_height) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MouseController::Destroy() {
|
int MouseController::Destroy() { return 0; }
|
||||||
if (uinput_fd_) {
|
|
||||||
ioctl(uinput_fd_, UI_DEV_DESTROY);
|
|
||||||
close(uinput_fd_);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MouseController::SendCommand(RemoteAction remote_action) {
|
int MouseController::SendCommand(RemoteAction remote_action) {
|
||||||
int mouse_pos_x = remote_action.m.x * screen_width_ / 1280;
|
int mouse_pos_x = remote_action.m.x * screen_width_ / 1280;
|
||||||
|
|||||||
@@ -9,7 +9,12 @@ unsigned char nv12_buffer_[NV12_BUFFER_SIZE];
|
|||||||
|
|
||||||
ScreenCapturerX11::ScreenCapturerX11() {}
|
ScreenCapturerX11::ScreenCapturerX11() {}
|
||||||
|
|
||||||
ScreenCapturerX11::~ScreenCapturerX11() {}
|
ScreenCapturerX11::~ScreenCapturerX11() {
|
||||||
|
if (inited_ && capture_thread_->joinable()) {
|
||||||
|
capture_thread_->join();
|
||||||
|
inited_ = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int ScreenCapturerX11::Init(const RECORD_DESKTOP_RECT &rect, const int fps,
|
int ScreenCapturerX11::Init(const RECORD_DESKTOP_RECT &rect, const int fps,
|
||||||
cb_desktop_data cb) {
|
cb_desktop_data cb) {
|
||||||
@@ -96,14 +101,7 @@ int ScreenCapturerX11::Init(const RECORD_DESKTOP_RECT &rect, const int fps,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScreenCapturerX11::Destroy() {
|
int ScreenCapturerX11::Destroy() { return 0; }
|
||||||
if (inited_ && capture_thread_->joinable()) {
|
|
||||||
capture_thread_->join();
|
|
||||||
inited_ = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ScreenCapturerX11::Start() {
|
int ScreenCapturerX11::Start() {
|
||||||
capture_thread_.reset(new std::thread([this]() {
|
capture_thread_.reset(new std::thread([this]() {
|
||||||
|
|||||||
@@ -9,7 +9,12 @@ unsigned char nv12_buffer_[NV12_BUFFER_SIZE];
|
|||||||
|
|
||||||
ScreenCapturerAvf::ScreenCapturerAvf() {}
|
ScreenCapturerAvf::ScreenCapturerAvf() {}
|
||||||
|
|
||||||
ScreenCapturerAvf::~ScreenCapturerAvf() {}
|
ScreenCapturerAvf::~ScreenCapturerAvf() {
|
||||||
|
if (inited_ && capture_thread_->joinable()) {
|
||||||
|
capture_thread_->join();
|
||||||
|
inited_ = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int ScreenCapturerAvf::Init(const RECORD_DESKTOP_RECT &rect, const int fps,
|
int ScreenCapturerAvf::Init(const RECORD_DESKTOP_RECT &rect, const int fps,
|
||||||
cb_desktop_data cb) {
|
cb_desktop_data cb) {
|
||||||
@@ -97,14 +102,7 @@ int ScreenCapturerAvf::Init(const RECORD_DESKTOP_RECT &rect, const int fps,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScreenCapturerAvf::Destroy() {
|
int ScreenCapturerAvf::Destroy() { return 0; }
|
||||||
if (inited_ && capture_thread_->joinable()) {
|
|
||||||
capture_thread_->join();
|
|
||||||
inited_ = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ScreenCapturerAvf::Start() {
|
int ScreenCapturerAvf::Start() {
|
||||||
capture_thread_.reset(new std::thread([this]() {
|
capture_thread_.reset(new std::thread([this]() {
|
||||||
|
|||||||
@@ -35,7 +35,20 @@ HMONITOR GetPrimaryMonitor() {
|
|||||||
|
|
||||||
ScreenCapturerWgc::ScreenCapturerWgc() {}
|
ScreenCapturerWgc::ScreenCapturerWgc() {}
|
||||||
|
|
||||||
ScreenCapturerWgc::~ScreenCapturerWgc() {}
|
ScreenCapturerWgc::~ScreenCapturerWgc() {
|
||||||
|
Stop();
|
||||||
|
CleanUp();
|
||||||
|
|
||||||
|
if (nv12_frame_) {
|
||||||
|
delete nv12_frame_;
|
||||||
|
nv12_frame_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nv12_frame_scaled_) {
|
||||||
|
delete nv12_frame_scaled_;
|
||||||
|
nv12_frame_scaled_ = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ScreenCapturerWgc::IsWgcSupported() {
|
bool ScreenCapturerWgc::IsWgcSupported() {
|
||||||
try {
|
try {
|
||||||
@@ -91,22 +104,7 @@ int ScreenCapturerWgc::Init(const RECORD_DESKTOP_RECT &rect, const int fps,
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScreenCapturerWgc::Destroy() {
|
int ScreenCapturerWgc::Destroy() { return 0; }
|
||||||
if (nv12_frame_) {
|
|
||||||
delete nv12_frame_;
|
|
||||||
nv12_frame_ = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nv12_frame_scaled_) {
|
|
||||||
delete nv12_frame_scaled_;
|
|
||||||
nv12_frame_scaled_ = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Stop();
|
|
||||||
CleanUp();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ScreenCapturerWgc::Start() {
|
int ScreenCapturerWgc::Start() {
|
||||||
if (_running == true) {
|
if (_running == true) {
|
||||||
|
|||||||
Reference in New Issue
Block a user