Skip to content

Commit 26b05df

Browse files
committed
windows: Move out original handle in to_receiver() and to_sender()
Like in the other back-ends, remove (`mem::replae()`) the original handle while constructing the wrappers, to make sure we do not keep around a copy that might interfere if reused accidentally.
1 parent 3134354 commit 26b05df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/platform/windows/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,11 +1432,11 @@ impl OsOpaqueIpcChannel {
14321432
}
14331433

14341434
pub fn to_receiver(&mut self) -> OsIpcReceiver {
1435-
unsafe { OsIpcReceiver::from_handle(self.handle) }
1435+
unsafe { OsIpcReceiver::from_handle(mem::replace(&mut self.handle, INVALID_HANDLE_VALUE)) }
14361436
}
14371437

14381438
pub fn to_sender(&mut self) -> OsIpcSender {
1439-
unsafe { OsIpcSender::from_handle(self.handle) }
1439+
unsafe { OsIpcSender::from_handle(mem::replace(&mut self.handle, INVALID_HANDLE_VALUE)) }
14401440
}
14411441
}
14421442

0 commit comments

Comments
 (0)