PolyMeilex / rfd

Rusty File Dialog
MIT License
564 stars 64 forks source link

Dragging and dropping file from file dialog to winit window causes memory corruption on windows. #71

Open Kl4rry opened 2 years ago

Kl4rry commented 2 years ago

When a file is dragged from an open rfd dialog and dropped in a winit window the program crashes with the error:

(exit code: 0xc0000374, STATUS_HEAP_CORRUPTION)
PolyMeilex commented 2 years ago

Hi!

  1. Is this async dialog or sync one?
  2. If it is sync, is there any threading involved?
  3. Could you perhaps provide a full rust-gdb backtrace? That would be helpful.
Be-ing commented 2 years ago

What OS?

PolyMeilex commented 2 years ago

STATUS_HEAP_CORRUPTION looks like Microsoft COM error, so I assume windows. Winit uses COM to handle it's drag and drop so we are probably having some races related to that. I remember having the same problems with cpal audio + winit drag and drop

Kl4rry commented 2 years ago
  1. The sync dialog was used
  2. The dialog was spawned from a second thread to avoid blocking the winit main thread I would provid a rust-gdb backtrace if i knew how to create one.
PolyMeilex commented 2 years ago

rust-gdb should be available out of the box in rust toolchain.

1. rust-gdb ./path/to/binary
2. type in `run` (or `r` for short)
3. reproduce the crash
4. type in `backtrace`
Kl4rry commented 2 years ago

It does not seem to be avaliable by default. I ran in to this isssue while trying to run it rust-lang/rustup#2838. Both using the gnu and msvc toolchains.