mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-19 11:11:04 +03:00
win clipboard context, use ref instead of box ref
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
@@ -57,15 +57,10 @@ impl ContextSend {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn proc<F: FnOnce(&mut Box<CliprdrClientContext>) -> u32>(f: F) -> u32 {
|
||||
pub fn proc<F: FnOnce(&mut CliprdrClientContext) -> u32>(f: F) -> u32 {
|
||||
let lock = CONTEXT_SEND.addr.lock().unwrap();
|
||||
if *lock != 0 {
|
||||
unsafe {
|
||||
let mut context = Box::from_raw(*lock as *mut CliprdrClientContext);
|
||||
let code = f(&mut context);
|
||||
std::mem::forget(context);
|
||||
code
|
||||
}
|
||||
unsafe { f(&mut *(*lock as *mut CliprdrClientContext)) }
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user