Reviewed by Tim Hatcher
authorsullivan@apple.com <sullivan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2007 18:51:21 +0000 (18:51 +0000)
committersullivan@apple.com <sullivan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2007 18:51:21 +0000 (18:51 +0000)
        - speculative fix for <rdar://problem/5509989> CrashTracer: [USER] 1 crash in Safari at com.apple.WebKit:
        -[WebPDFView(FileInternal) _updatePreferencesSoon] + 56

        The crash is probably due to messaging a dealloc'ed dataSource ivar. The dataSource ivar isn't retained
        by this class, but should be. (It is retained by WebHTMLView, e.g.).

        * WebView/WebPDFView.mm:
        (-[WebPDFView dealloc]):
        release dataSource ivar
        (-[WebPDFView setDataSource:]):
        retain dataSource ivar

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

WebKit/mac/ChangeLog
WebKit/mac/WebView/WebPDFView.mm

index 66757bbd80ed0866e89f4fd7863dc3615118b485..0304f285557b20657e473b5e76a30456dbe120b7 100644 (file)
@@ -1,3 +1,19 @@
+2007-11-12  John Sullivan  <sullivan@apple.com>
+
+        Reviewed by Tim Hatcher
+        
+        - speculative fix for <rdar://problem/5509989> CrashTracer: [USER] 1 crash in Safari at com.apple.WebKit: 
+        -[WebPDFView(FileInternal) _updatePreferencesSoon] + 56
+        
+        The crash is probably due to messaging a dealloc'ed dataSource ivar. The dataSource ivar isn't retained
+        by this class, but should be. (It is retained by WebHTMLView, e.g.).
+
+        * WebView/WebPDFView.mm:
+        (-[WebPDFView dealloc]):
+        release dataSource ivar
+        (-[WebPDFView setDataSource:]):
+        retain dataSource ivar
+
 2007-11-09  Tristan O'Tierney  <tristan@apple.com>
 
         Reviewed by Timothy Hatcher.
index deec13f80eb065ed4dbbf57f9d0d5fa675e17f61..bdf2697bf1f76b3663bbbb39a87f629be1598a37 100644 (file)
@@ -183,6 +183,7 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
 - (void)dealloc
 {
     ASSERT(!trackedFirstResponder);
+    [dataSource release];
     [previewView release];
     [PDFSubview release];
     [path release];
@@ -528,7 +529,13 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
 
 - (void)setDataSource:(WebDataSource *)ds
 {
-    dataSource = ds;
+    if (dataSource == ds)
+        return;
+
+    dataSource = [ds retain];
+    
+    // FIXME: There must be some better place to put this. There is no comment in ChangeLog
+    // explaining why it's in this method.
     [self setFrame:[[self superview] frame]];
 }