Reviewed by Eric.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Jan 2007 10:11:50 +0000 (10:11 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Jan 2007 10:11:50 +0000 (10:11 +0000)
        <rdar://problem/4887781> Seed: Repro Safari crash in -[WebHTMLRepresentation receivedData:withDataSource:] (music.aol.com)

        * WebView/WebDataSource.mm:
        (-[WebDataSource _receivedData:]): Protect self against destruction partway through this method.

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

WebKit/ChangeLog
WebKit/WebView/WebDataSource.mm

index 3cab4ef01d6bcfefe31b8f5f012891b3ed1bc5a2..6ce6da9b8790de3f17d8b2c88f108d6f274368af 100644 (file)
@@ -1,3 +1,12 @@
+2007-01-17  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Eric.
+        
+        <rdar://problem/4887781> Seed: Repro Safari crash in -[WebHTMLRepresentation receivedData:withDataSource:] (music.aol.com)
+
+        * WebView/WebDataSource.mm:
+        (-[WebDataSource _receivedData:]): Protect self against destruction partway through this method.
+
 2007-01-16  Alice Liu  <alice.liu@apple.com>
 
         Reviewed by harrison.
index f82457601f28d81ab0c615bf50d0f139e9448e92..3b9dcd8995756c28534ebf52ebe20b082a12841f 100644 (file)
@@ -70,7 +70,6 @@ using namespace WebCore;
     id <WebDocumentRepresentation> representation;
     
     WebUnarchivingState *unarchivingState;
-    NSMutableDictionary *subresources;
     BOOL representationFinishedLoading;
 }
 
@@ -172,6 +171,9 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
 
 - (void)_receivedData:(NSData *)data
 {
+    // protect self temporarily, as the bridge receivedData call could remove our last ref
+    RetainPtr<WebDataSource*> protect(self);
+    
     [[self representation] receivedData:data withDataSource:self];
     [[[[self webFrame] frameView] documentView] dataSourceUpdated:self];
 }