diff options
Diffstat (limited to 'WebKit/mac/WebView/WebDataSource.mm')
-rw-r--r-- | WebKit/mac/WebView/WebDataSource.mm | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/WebKit/mac/WebView/WebDataSource.mm b/WebKit/mac/WebView/WebDataSource.mm index 12afcb3..57347d3 100644 --- a/WebKit/mac/WebView/WebDataSource.mm +++ b/WebKit/mac/WebView/WebDataSource.mm @@ -88,9 +88,12 @@ using namespace WebCore; if (WebCoreObjCScheduleDeallocateOnMainThread([WebDataSourcePrivate class], self)) return; - ASSERT(!loader->isLoading()); - loader->detachDataSource(); - loader->deref(); + ASSERT(loader); + if (loader) { + ASSERT(!loader->isLoading()); + loader->detachDataSource(); + loader->deref(); + } [representation release]; @@ -101,9 +104,12 @@ using namespace WebCore; { ASSERT_MAIN_THREAD(); - ASSERT(!loader->isLoading()); - loader->detachDataSource(); - loader->deref(); + ASSERT(loader); + if (loader) { + ASSERT(!loader->isLoading()); + loader->detachDataSource(); + loader->deref(); + } [super finalize]; } @@ -484,9 +490,14 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl _private->loader->getSubresources(coreSubresources); NSMutableArray *subresources = [[NSMutableArray alloc] initWithCapacity:coreSubresources.size()]; - for (unsigned i = 0; i < coreSubresources.size(); ++i) - [subresources addObject:[[[WebResource alloc] _initWithCoreResource:coreSubresources[i]] autorelease]]; - + for (unsigned i = 0; i < coreSubresources.size(); ++i) { + WebResource *resource = [[WebResource alloc] _initWithCoreResource:coreSubresources[i]]; + if (resource) { + [subresources addObject:resource]; + [resource release]; + } + } + return [subresources autorelease]; } |