simple refactor

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-07-16 08:41:32 +08:00
parent 2051bee3cf
commit 7bc98ee434
2 changed files with 7 additions and 25 deletions

View File

@@ -186,21 +186,6 @@ pub(super) async fn check_init() -> ResultType<()> {
Ok(())
}
pub fn clear() {
if scrap::is_x11() {
return;
}
let mut lock = CAP_DISPLAY_INFO.write().unwrap();
if *lock != 0 {
unsafe {
let cap_display_info = Box::from_raw(*lock as *mut CapDisplayInfo);
let _ = Box::from_raw(cap_display_info.capturer.0);
}
*lock = 0;
}
}
pub(super) async fn get_displays() -> ResultType<(usize, Vec<DisplayInfo>)> {
check_init().await?;
let addr = *CAP_DISPLAY_INFO.read().unwrap();
@@ -230,8 +215,7 @@ pub(super) fn get_primary() -> ResultType<usize> {
}
}
#[allow(dead_code)]
pub(super) fn release_resource() {
pub fn clear() {
if scrap::is_x11() {
return;
}