HSCountingInputStream icon indicating copy to clipboard operation
HSCountingInputStream copied to clipboard

Getting EXC_BAD_ACCESS exception

Open erdnussflips opened this issue 9 years ago • 3 comments

I'm getting an EXC_BAD_ACCESS exception at (BOOL)_setCFClientFlags:(CFOptionFlags)inFlags callback:(CFReadStreamClientCallBack)inCallback context:(CFStreamClientContext *)inContext in HSRandomDataInputStream on copiedCallback((CFReadStreamRef)CFBridgingRetain(self), kCFStreamEventHasBytesAvailable, &copiedContext);

Do you have an idea?

erdnussflips avatar May 30 '16 11:05 erdnussflips

I also have this issue when I try to use the HSRandomDataInputStream with Alamofire's upload and to an HTTPS url; it works with an HTTP url though; very strange?

GregOriol avatar Apr 27 '17 14:04 GregOriol

I think some of the innards aren't necessarily set up yet when _setCFClientFlags first gets invoked on certain systems (I'm seeing this on macOS 10.14, but not 10.15). The copiedCallback invocation doesn't seem to be necessary here anyway, and this fork does away with it. I'll submit a PR.

tomalakgeretkal avatar Feb 10 '21 15:02 tomalakgeretkal

Actually I'll leave the PR to someone else, but if you're only integrating with NSUrlSessions then you can skip all the callback invocations (in both read and setCFClientFlags).

Otherwise you'll need to be able to turn that on and off depending on the context. Look at https://github.com/pavelosipov/POSInputStreamLibrary for inspiration!

tomalakgeretkal avatar Feb 10 '21 16:02 tomalakgeretkal