Reviewed by Adam Roben
authorsullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Nov 2006 23:22:33 +0000 (23:22 +0000)
committersullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Nov 2006 23:22:33 +0000 (23:22 +0000)
        - fixed <rdar://problem/4801351> Crash reloading PDF file in new Safari (or closing a window containing a PDF file)

        * WebView/WebPDFView.mm:
        (-[WebPDFView initWithFrame:]):
        Retain the PDFSubview in the code path where we just obtain it by asking the PDFPreviewView for it. We were
        unconditionally releasing it in dealloc, but only retaining it in one of the two code paths.

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

WebKit/ChangeLog
WebKit/WebView/WebPDFView.mm

index 2f7e0deb8301d29b2bf89dde2d1b0ddcfccac810..31352572f78a032f73922f4d81b7a2d508e708c1 100644 (file)
@@ -1,3 +1,14 @@
+2006-11-01  John Sullivan  <sullivan@apple.com>
+
+        Reviewed by Adam Roben
+        
+        - fixed <rdar://problem/4801351> Crash reloading PDF file in new Safari (or closing a window containing a PDF file)
+
+        * WebView/WebPDFView.mm:
+        (-[WebPDFView initWithFrame:]):
+        Retain the PDFSubview in the code path where we just obtain it by asking the PDFPreviewView for it. We were
+        unconditionally releasing it in dealloc, but only retaining it in one of the two code paths.
+
 2006-10-31  Mark Rowe  <bdash@webkit.org>
 
         Reviewed by Maciej.
 2006-10-31  Mark Rowe  <bdash@webkit.org>
 
         Reviewed by Maciej.
index 71ef1caccfe74a0725dfdcc550c0c18ac26d1c35..96cc41e736bdefc1819f7634667d5654d67765f0 100644 (file)
@@ -290,7 +290,10 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
         
         NSView *topLevelPDFKitView = nil;
         if (previewView) {
         
         NSView *topLevelPDFKitView = nil;
         if (previewView) {
-            PDFSubview = [previewView performSelector:@selector(pdfView)];
+            // We'll retain the PDFSubview here so that it is equally retained in all
+            // code paths. That way we don't need to worry about conditionally releasing
+            // it later.
+            PDFSubview = [[previewView performSelector:@selector(pdfView)] retain];
             topLevelPDFKitView = previewView;
         } else {
             PDFSubview = [[[[self class] _PDFViewClass] alloc] initWithFrame:frame];
             topLevelPDFKitView = previewView;
         } else {
             PDFSubview = [[[[self class] _PDFViewClass] alloc] initWithFrame:frame];