Frugghi / SwiftSH

A Swift SSH framework that wraps libssh2.
MIT License
195 stars 75 forks source link

changed unowned to weak for unsafe situations #9

Closed jpalten closed 6 years ago

jpalten commented 6 years ago

Using unowned self in async calls or closures can cause crashes or memory leaks. This pull requests fixes most of those unowned self to use weak self, which is much safer in most situations. Hope it helps!

jpalten commented 6 years ago

I'll create a PR for only the unowned, and will do a little research on the unspecified strong references in closures. I'm not entirely sure that the self will ever get released, even after the block got executed. I'll get back to you on that...

Frugghi commented 6 years ago

I'm going to merge the other one, thanks!