SwiftFolderMonitor icon indicating copy to clipboard operation
SwiftFolderMonitor copied to clipboard

Crashes on deinit for more

Open Megatron1000 opened this issue 6 years ago • 2 comments

Initialised it with a directory. When the object gets dealloced I get an EXC_BADINSTRUCTION

Megatron1000 avatar Nov 21 '18 20:11 Megatron1000

Did you ever find a solution to this? I'm getting it too

PatMurrayDEV avatar Mar 25 '19 00:03 PatMurrayDEV

I found a solution: A DispatchSource must not be be suspended when it is cancelled. By adding resume() to the deinit we can ensure it is definitely not suspended.

deinit {
    source.resume()
    close(descriptor)
    source.cancel()
}

PatMurrayDEV avatar Apr 01 '19 00:04 PatMurrayDEV