Re: Custom NSURLProtocol crashes when using Garbage Collection
Re: Custom NSURLProtocol crashes when using Garbage Collection
- Subject: Re: Custom NSURLProtocol crashes when using Garbage Collection
- From: Greg Parker <email@hidden>
- Date: Mon, 19 Oct 2009 09:41:17 -0700
On Oct 19, 2009, at 2:16 AM, Keith Duncan wrote:
I wrote a simple NSURLProtocol subclass and started observing
crashes in URL Loading code. I've extracted the crasher into a
simple test project which loads an image from a URL with custom
scheme which I handle every hundredth of a second.
When compiled with -fobjc-gc it reliably crashes; without it runs
indefinitely however, there are leaked NSString instances allocated
by NSURLConnection in +sendSynchronousRequest:… I've filed this as rdar://problem/7314551
for reference.
The test project can be found http://33software.com/files/CrashLoadingURL.zip
The bug is reproductable in the SpecialPictureProtocol sample code
if compiled for garbage collection too.
Can anyone else verify this or point to a workaround?
Looks like a bug somewhere, and I don't see anything obviously wrong
in your code.
At first I was suspicious because your -startLoading code calls other
notifications like didReceiveResponse and didFinishLoading. Some
clients can be confused about that; they aren't prepared for the
connection to be torn down that early. The usual solution is to do the
real work using performSelector:@selector(doRealWork) withObject:nil
afterDelay:0.0, but I tried that and it still crashed.
At this point I expect there's a GC bug in the NSURLProtocol
machinery, specifically the bridge between NSURLProtocol and
CFURLProtocol. We'll look further in 7314551.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden