Improve handling of file paths in the windows DnD handler (#980)
* Make FileDropHandler::iterate_filenames more robust by replacing the call to mem::uninitialized with mem::zeroed and change file name retrieval to use buffers of exact length as reported by DragQueryFileW instead of relying on MAX_PATH. * Change remaining calls of uninitialized to zeroed * Run rustfmt * Add CHANGELOG entry and comment
This commit is contained in:
parent
e37e46b155
commit
5bf303fd26
7 changed files with 24 additions and 20 deletions
|
|
@ -182,7 +182,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
}
|
||||
|
||||
unsafe {
|
||||
let mut msg = mem::uninitialized();
|
||||
let mut msg = mem::zeroed();
|
||||
let mut msg_unprocessed = false;
|
||||
|
||||
'main: loop {
|
||||
|
|
@ -507,7 +507,7 @@ impl<T> EventLoopRunner<T> {
|
|||
|
||||
// Returns true if the wait time was reached, and false if a message must be processed.
|
||||
unsafe fn wait_until_time_or_msg(wait_until: Instant) -> bool {
|
||||
let mut msg = mem::uninitialized();
|
||||
let mut msg = mem::zeroed();
|
||||
let now = Instant::now();
|
||||
if now <= wait_until {
|
||||
// MsgWaitForMultipleObjects tends to overshoot just a little bit. We subtract 1 millisecond
|
||||
|
|
@ -1645,7 +1645,7 @@ unsafe extern "system" fn thread_event_target_callback<T>(
|
|||
}
|
||||
};
|
||||
if in_modal_loop {
|
||||
let mut msg = mem::uninitialized();
|
||||
let mut msg = mem::zeroed();
|
||||
loop {
|
||||
if 0 == winuser::PeekMessageW(&mut msg, ptr::null_mut(), 0, 0, 0) {
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue