+2007-08-05 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/5369110> CrashTracer: [USER] reproducible crash opening particular mail messages
+
+ * platform/network/mac/ResourceHandleMac.mm:
+ (-[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:]): Make sure to retain
+ self for the body of this method. Otherwise, the willSendRequest could trigger events which will
+ cancel the connection, and we access ivars after this point.
+ (-[WebCoreSynchronousLoader connection:willSendRequest:redirectResponse:]): retain and release
+ in the right order.
+
2007-08-04 Adam Roben <aroben@apple.com>
Another workaround for <rdar://problem/5386894>
- (NSURLRequest *)connection:(NSURLConnection *)con willSendRequest:(NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse
{
+ // the willSendRequest call may cancel this load, in which case self could be deallocated
+ RetainPtr<WebCoreResourceHandleAsDelegate> protect(self);
+
if (!m_handle || !m_handle->client())
return nil;
++inNSURLConnectionCallback;
m_handle->client()->willSendRequest(m_handle, request, redirectResponse);
--inNSURLConnectionCallback;
#ifndef BUILDING_ON_TIGER
+ NSURL *copy = [[request.nsURLRequest() URL] copy];
[m_url release];
- m_url = [[request.nsURLRequest() URL] copy];
+ m_url = copy;
#endif
return request.nsURLRequest();
- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)newRequest redirectResponse:(NSURLResponse *)redirectResponse
{
+ NSURL *copy = [[newRequest URL] copy];
[m_url release];
- m_url = [[newRequest URL] copy];
+ m_url = copy;
return newRequest;
}