[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:07:03 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 37a54cad5d0eb9e945b85d50964253038ff8f38c
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Nov 23 01:27:04 2002 +0000
Fixed: 3078737 - Crash in -[WebHistoryItem dealloc] after closing last window
* Misc.subproj/WebIconDatabase.m:
(-[WebIconDatabase releaseIconForSiteURL:]): retain the site URL string because it may get released from beneath
(-[WebIconDatabase _updateFileDatabase]): tweak
(-[WebIconDatabase _iconsForIconURLString:]): disable timings for deployment build
(-[WebIconDatabase _setIconURL:forSiteURL:]): tweak
(-[WebIconDatabase _releaseIconForIconURLString:]): tweak
(-[WebIconDatabase _scaleIcon:toSize:]): disable timings for deployment build
* Misc.subproj/WebIconDatabasePrivate.h:
* WebView.subproj/WebDataSourcePrivate.m:
(-[WebDataSource _updateIconDatabaseWithURL:]): new, does the db binding
(-[WebDataSource _loadIcon]): call _updateIconDatabaseWithURL
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2835 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index cc6d715..939765c 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,21 @@
2002-11-22 Chris Blumenberg <cblu at apple.com>
+ Fixed: 3078737 - Crash in -[WebHistoryItem dealloc] after closing last window
+
+ * Misc.subproj/WebIconDatabase.m:
+ (-[WebIconDatabase releaseIconForSiteURL:]): retain the site URL string because it may get released from beneath
+ (-[WebIconDatabase _updateFileDatabase]): tweak
+ (-[WebIconDatabase _iconsForIconURLString:]): disable timings for deployment build
+ (-[WebIconDatabase _setIconURL:forSiteURL:]): tweak
+ (-[WebIconDatabase _releaseIconForIconURLString:]): tweak
+ (-[WebIconDatabase _scaleIcon:toSize:]): disable timings for deployment build
+ * Misc.subproj/WebIconDatabasePrivate.h:
+ * WebView.subproj/WebDataSourcePrivate.m:
+ (-[WebDataSource _updateIconDatabaseWithURL:]): new, does the db binding
+ (-[WebDataSource _loadIcon]): call _updateIconDatabaseWithURL
+
+2002-11-22 Chris Blumenberg <cblu at apple.com>
+
Attempt to fix: 3078737 - Crash in -[WebHistoryItem dealloc] after closing last window
I haven't found anything that would cause the crash. I did some clean-up, added asserts and error messages in hopes that this help me track this down.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index cc6d715..939765c 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,5 +1,21 @@
2002-11-22 Chris Blumenberg <cblu at apple.com>
+ Fixed: 3078737 - Crash in -[WebHistoryItem dealloc] after closing last window
+
+ * Misc.subproj/WebIconDatabase.m:
+ (-[WebIconDatabase releaseIconForSiteURL:]): retain the site URL string because it may get released from beneath
+ (-[WebIconDatabase _updateFileDatabase]): tweak
+ (-[WebIconDatabase _iconsForIconURLString:]): disable timings for deployment build
+ (-[WebIconDatabase _setIconURL:forSiteURL:]): tweak
+ (-[WebIconDatabase _releaseIconForIconURLString:]): tweak
+ (-[WebIconDatabase _scaleIcon:toSize:]): disable timings for deployment build
+ * Misc.subproj/WebIconDatabasePrivate.h:
+ * WebView.subproj/WebDataSourcePrivate.m:
+ (-[WebDataSource _updateIconDatabaseWithURL:]): new, does the db binding
+ (-[WebDataSource _loadIcon]): call _updateIconDatabaseWithURL
+
+2002-11-22 Chris Blumenberg <cblu at apple.com>
+
Attempt to fix: 3078737 - Crash in -[WebHistoryItem dealloc] after closing last window
I haven't found anything that would cause the crash. I did some clean-up, added asserts and error messages in hopes that this help me track this down.
diff --git a/WebKit/Misc.subproj/WebIconDatabase.m b/WebKit/Misc.subproj/WebIconDatabase.m
index dc0453b..ee1ada7 100644
--- a/WebKit/Misc.subproj/WebIconDatabase.m
+++ b/WebKit/Misc.subproj/WebIconDatabase.m
@@ -48,7 +48,6 @@ NSSize WebIconLargeSize = {128, 128};
- (void)_retainOriginalIconsOnDisk;
- (void)_releaseOriginalIconsOnDisk;
- (void)_sendNotificationForSiteURL:(NSURL *)siteURL;
-- (void)_addObject:(id)object toSetForKey:(id)key inDictionary:(NSMutableDictionary *)dictionary;
- (NSImage *)_largestIconFromDictionary:(NSMutableDictionary *)icons;
- (NSMutableDictionary *)_iconsBySplittingRepresentationsOfIcon:(NSImage *)icon;
- (NSImage *)_iconFromDictionary:(NSMutableDictionary *)icons forSize:(NSSize)size cache:(BOOL)cache;
@@ -166,12 +165,15 @@ NSSize WebIconLargeSize = {128, 128};
ASSERT(siteURL);
NSString *iconURLString = [_private->siteURLToIconURL objectForKey:[siteURL absoluteString]];
+ [iconURLString retain];
if(iconURLString){
[self _releaseIconForIconURLString:iconURLString];
}else{
[self _releaseFutureIconForSiteURL:siteURL];
}
+
+ [iconURLString release];
}
- (void)delayDatabaseCleanup
@@ -309,6 +311,7 @@ NSSize WebIconLargeSize = {128, 128};
NSImage *icon = [self _largestIconFromDictionary:icons];
NSData *iconData = [icon TIFFRepresentation];
if(iconData){
+ //NSLog(@"Writing icon: %@", iconURLString);
[fileDB setObject:iconData forKey:iconURLString];
[_private->iconsOnDiskWithURLs addObject:iconURLString];
}
@@ -318,15 +321,15 @@ NSSize WebIconLargeSize = {128, 128};
[_private->iconsToSaveWithURLs removeAllObjects];
// Save the icon dictionaries to disk
- [fileDB setObject:_private->iconsOnDiskWithURLs forKey:WebIconsOnDiskKey];
- [fileDB setObject:_private->siteURLToIconURL forKey:WebSiteURLToIconURLKey];
- [fileDB setObject:_private->iconURLToSiteURLs forKey:WebIconURLToSiteURLsKey];
+ [fileDB setObject:_private->iconsOnDiskWithURLs forKey:WebIconsOnDiskKey];
+ [fileDB setObject:_private->siteURLToIconURL forKey:WebSiteURLToIconURLKey];
+ [fileDB setObject:_private->iconURLToSiteURLs forKey:WebIconURLToSiteURLsKey];
}
-- (BOOL)_hasIconForSiteURL:(NSURL *)siteURL
+- (BOOL)_hasIconForIconURL:(NSURL *)iconURL;
{
- if ([siteURL isFileURL] ||
- [_private->siteURLToIconURL objectForKey:[siteURL absoluteString]]){
+ if ([iconURL isFileURL] ||
+ [_private->iconURLToSiteURLs objectForKey:[iconURL absoluteString]]){
return YES;
}
@@ -344,7 +347,9 @@ NSSize WebIconLargeSize = {128, 128};
// Not in memory, check disk
if([_private->iconsOnDiskWithURLs containsObject:iconURLString]){
- start = CFAbsoluteTimeGetCurrent();
+#if LOG_ENABLED
+ double start = CFAbsoluteTimeGetCurrent();
+#endif
NSData *iconData = [_private->fileDatabase objectForKey:iconURLString];
if(iconData){
@@ -352,8 +357,10 @@ NSSize WebIconLargeSize = {128, 128};
icons = [self _iconsBySplittingRepresentationsOfIcon:icon];
if(icons){
- duration = CFAbsoluteTimeGetCurrent() - start;
+#if LOG_ENABLED
+ double duration = CFAbsoluteTimeGetCurrent() - start;
LOG(Timing, "loading and creating icon %@ took %f seconds", iconURLString, duration);
+#endif
[_private->iconURLToIcons setObject:icons forKey:iconURLString];
}
}
@@ -415,10 +422,21 @@ NSSize WebIconLargeSize = {128, 128};
NSString *siteURLString = [siteURL absoluteString];
NSString *iconURLString = [iconURL absoluteString];
+
+ if([[_private->siteURLToIconURL objectForKey:siteURLString] isEqualToString:iconURLString]){
+ // Don't do any work if the iconURL is already bound to site URL
+ return;
+ }
[_private->siteURLToIconURL setObject:iconURLString forKey:siteURLString];
- [self _addObject:siteURLString toSetForKey:iconURLString inDictionary:_private->iconURLToSiteURLs];
+ NSMutableSet *siteURLStrings = [_private->iconURLToSiteURLs objectForKey:iconURLString];
+ if(!siteURLStrings){
+ siteURLStrings = [NSMutableSet set];
+ [_private->iconURLToSiteURLs setObject:siteURLStrings forKey:iconURLString];
+ }
+ [siteURLStrings addObject:siteURLString];
+
NSNumber *futureRetainCount = [_private->futureSiteURLToRetainCount objectForKey:siteURLString];
@@ -463,7 +481,7 @@ NSSize WebIconLargeSize = {128, 128};
NSNumber *retainCount = [_private->iconURLToRetainCount objectForKey:iconURLString];
if (!retainCount) {
- ERROR("Tried release a non-retained icon: %@", iconURLString);
+ ERROR("Tried to release a non-retained icon: %@", iconURLString);
return;
}
@@ -569,22 +587,6 @@ NSSize WebIconLargeSize = {128, 128};
userInfo:userInfo];
}
-- (void)_addObject:(id)object toSetForKey:(id)key inDictionary:(NSMutableDictionary *)dictionary
-{
- ASSERT(key);
- ASSERT(object);
- ASSERT(dictionary);
-
- NSMutableSet *set = [dictionary objectForKey:key];
-
- if(!set){
- set = [NSMutableSet set];
- }
-
- [set addObject:object];
- [dictionary setObject:set forKey:key];
-}
-
- (NSImage *)_largestIconFromDictionary:(NSMutableDictionary *)icons
{
ASSERT(icons);
@@ -652,14 +654,18 @@ NSSize WebIconLargeSize = {128, 128};
{
ASSERT(size.width);
ASSERT(size.height);
-
+
+#if LOG_ENABLED
double start = CFAbsoluteTimeGetCurrent();
-
+#endif
+
[icon setScalesWhenResized:YES];
[icon setSize:size];
+#if LOG_ENABLED
double duration = CFAbsoluteTimeGetCurrent() - start;
LOG(Timing, "scaling icon took %f seconds.", duration);
+#endif
}
@end
diff --git a/WebKit/Misc.subproj/WebIconDatabasePrivate.h b/WebKit/Misc.subproj/WebIconDatabasePrivate.h
index 87b5d3c..e997873 100644
--- a/WebKit/Misc.subproj/WebIconDatabasePrivate.h
+++ b/WebKit/Misc.subproj/WebIconDatabasePrivate.h
@@ -45,6 +45,6 @@
// Called by WebDataSource to bind a web site URL to a icon URL and icon image.
- (void)_setIconURL:(NSURL *)iconURL forSiteURL:(NSURL *)siteURL;
-- (BOOL)_hasIconForSiteURL:(NSURL *)siteURL;
+- (BOOL)_hasIconForIconURL:(NSURL *)iconURL;
@end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 4ca2904..284bf33 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -478,49 +478,42 @@
[self _commitIfReady];
}
-- (void)iconLoader:(WebIconLoader *)iconLoader receivedPageIcon:(NSImage *)icon;
+- (void)_updateIconDatabaseWithURL:(NSURL *)iconURL
{
WebIconDatabase *iconDB = [WebIconDatabase sharedIconDatabase];
- NSURL *originalURL = [[self _originalRequest] URL];
- NSURL *iconURL = [iconLoader URL];
- NSURL *URL = [self URL];
-
+
// Bind the URL of the original request and the final URL to the icon URL.
- [iconDB _setIconURL:iconURL forSiteURL:URL];
- if(![originalURL isEqualTo:URL]){
- [iconDB _setIconURL:iconURL forSiteURL:originalURL];
- }
-
+ [iconDB _setIconURL:iconURL forSiteURL:[self URL]];
+ [iconDB _setIconURL:iconURL forSiteURL:[[self _originalRequest] URL]];
[[_private->controller locationChangeDelegate] receivedPageIcon:nil forDataSource:self];
}
+- (void)iconLoader:(WebIconLoader *)iconLoader receivedPageIcon:(NSImage *)icon;
+{
+ [self _updateIconDatabaseWithURL:[iconLoader URL]];
+}
+
- (void)_loadIcon
{
ASSERT(!_private->iconLoader);
- if([self webFrame] == [[self controller] mainFrame] && !_private->mainDocumentError){
+ if([self webFrame] != [[self controller] mainFrame] || _private->mainDocumentError){
+ return;
+ }
+
+ if(!_private->iconURL){
+ // No icon URL from the LINK tag so try the server's root
+ _private->iconURL = [[[NSURL _web_URLWithString:@"/favicon.ico"
+ relativeToURL:[self URL]] absoluteURL] retain];
+ }
- // Use the original URL because thats what history items.
- NSURL *URL = [self URL];
- WebIconDatabase *iconDB = [WebIconDatabase sharedIconDatabase];
-
- if([iconDB _hasIconForSiteURL:URL]){
- // Tell about the icon immediately if the db already has it
- [[_private->controller locationChangeDelegate] receivedPageIcon:nil forDataSource:self];
+ if(_private->iconURL != nil){
+ if([[WebIconDatabase sharedIconDatabase] _hasIconForIconURL:_private->iconURL]){
+ [self _updateIconDatabaseWithURL:_private->iconURL];
}else{
-
- if(!_private->iconURL){
- // No icon URL from the LINK tag so try the server's root
- _private->iconURL = [[[NSURL _web_URLWithString:@"/favicon.ico"
- relativeToURL:URL] absoluteURL] retain];
- }
-
- if(_private->iconURL != nil){
- // Load it
- _private->iconLoader = [[WebIconLoader alloc] initWithURL:_private->iconURL];
- [_private->iconLoader setDelegate:self];
- [_private->iconLoader startLoading];
- }
+ _private->iconLoader = [[WebIconLoader alloc] initWithURL:_private->iconURL];
+ [_private->iconLoader setDelegate:self];
+ [_private->iconLoader startLoading];
}
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list