Skip to content

Commit

Permalink
fix UD behavior on windows - causes a crash on rust 1.78
Browse files Browse the repository at this point in the history
  • Loading branch information
amircodota authored and 0xpr03 committed Jun 26, 2024
1 parent 3df0f65 commit 023dae1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions notify/src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ fn start_read(rd: &ReadData, event_handler: Arc<Mutex<dyn EventHandler>>, handle
// for our own purposes

let req_buf = request.buffer.as_mut_ptr() as *mut c_void;
let request_p = Box::into_raw(request) as isize;
overlapped.hEvent = request_p;
let request_p = Box::into_raw(request);
overlapped.hEvent = request_p as isize;

// This is using an asynchronous call with a completion routine for receiving notifications
// An I/O completion port would probably be more performant
Expand All @@ -304,7 +304,7 @@ fn start_read(rd: &ReadData, event_handler: Arc<Mutex<dyn EventHandler>>, handle
// over to `ReadDirectoryChangesW`.
// So we can claim ownership back.
let _overlapped_alloc = std::mem::ManuallyDrop::into_inner(overlapped);
let request: Box<ReadDirectoryRequest> = mem::transmute(request_p);
let request: Box<ReadDirectoryRequest> = Box::from_raw(request_p);
ReleaseSemaphore(request.data.complete_sem, 1, ptr::null_mut());
}
}
Expand Down

0 comments on commit 023dae1

Please sign in to comment.