Reviewed by Maciej
authorbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jul 2006 06:35:05 +0000 (06:35 +0000)
committerbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jul 2006 06:35:05 +0000 (06:35 +0000)
        Small fix that prevents an assertion from triggering if the DB is being cleaned up
        (ie, the app being shut down)

        * Misc/WebIconDatabase.h:
        * Misc/WebIconDatabase.m:
        (-[NSMutableDictionary init]):
        (-[WebIconDatabase _applicationWillTerminate:]):
        (-[WebIconDatabase _releaseIconForIconURLString:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15180 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/Misc/WebIconDatabase.h
WebKit/Misc/WebIconDatabase.m

index cdfd96e6778877577cb609b3f222827b69386034..2ff5d3862e5b42e485b554181e0bfe0feea6d48b 100644 (file)
@@ -1,3 +1,16 @@
+2006-07-05  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Maciej
+
+        Small fix that prevents an assertion from triggering if the DB is being cleaned up 
+        (ie, the app being shut down)
+
+        * Misc/WebIconDatabase.h:
+        * Misc/WebIconDatabase.m:
+        (-[NSMutableDictionary init]):
+        (-[WebIconDatabase _applicationWillTerminate:]):
+        (-[WebIconDatabase _releaseIconForIconURLString:]):
+
 2006-07-05  Adele Peterson  <adele@apple.com>
 
         Reviewed by Maciej and Hyatt.
index 8c9f8ca74331816839c2bad9793644c459f8c1a0..76c30374fdbf47a4aec281f5d6dd61c8600256b5 100644 (file)
@@ -66,6 +66,7 @@ extern NSSize WebIconLargeSize;  // 128 x 128
 
 @private
     WebIconDatabasePrivate *_private;
+    BOOL _isClosing;
 }
 
 
index db3884acab9094683df667de4935624c0270d5af..efd1af4ef6509e325dc7013f42b00a8231a2b20f 100644 (file)
@@ -121,6 +121,8 @@ NSSize WebIconLargeSize = {128, 128};
     [self _createFileDatabase];
     [self _loadIconDictionaries];
 
+    _isClosing = NO;
+
     _private->databaseBridge = [WebCoreIconDatabaseBridge sharedBridgeInstance];
     if (_private->databaseBridge) {
         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
@@ -661,6 +663,7 @@ NSSize WebIconLargeSize = {128, 128};
     [_private->databaseBridge closeSharedDatabase];
     [_private->databaseBridge release];
     _private->databaseBridge = nil;
+    _isClosing = YES;
 }
 
 - (int)_totalRetainCountForIconURLString:(NSString *)iconURLString
@@ -818,6 +821,9 @@ NSSize WebIconLargeSize = {128, 128};
 {
     ASSERT(iconURLString);
     
+    if (![self _isEnabled] || _isClosing)
+        return;
+    
     WebNSUInteger retainCount = (WebNSUInteger)(void *)CFDictionaryGetValue(_private->iconURLToExtraRetainCount, iconURLString);
 
     ASSERT(retainCount > 0);