mastodon-ios icon indicating copy to clipboard operation
mastodon-ios copied to clipboard

Fix crash on media upload

Open j-f1 opened this issue 1 year ago • 0 comments

May fix #782.

Using the information linked by @kenji21 (Thank you so much for the pointer), I noticed that the OutputStream of SerialStream has its delegate set, but the delegate is never unset. OutputStream does indeed mark its delegate as unowned(unsafe) so this is likely the cause of the crash. I have not however tested this change since I haven’t seen the crash on my end.

I’m also a little concerned about the correctness of SerialStream. It’s not clear to me how long its lifetime is, and the fact that the crash occurred in at least one case “around 200kb/2.82MB” makes me worry that the SerialStream is being prematurely released. Not sure if there’s a good way to make sure it stays alive until the request is done.

j-f1 avatar Jan 05 '23 13:01 j-f1