Title: [289391] branches/safari-613.1.16.1-branch/Source/WebKit
Revision
289391
Author
[email protected]
Date
2022-02-08 10:55:41 -0800 (Tue, 08 Feb 2022)

Log Message

Cherry-pick r288848. rdar://problem/86950638

    Web Inspector: [Cocoa] Crash in WebKit::WebInspectorUIProxy::attachmentViewDidChange
    https://bugs.webkit.org/show_bug.cgi?id=235842

    Reviewed by Timothy Hatcher.

    Speculatively fix an occasional crash in WebKit::WebInspectorUIProxy::attachmentViewDidChange by ensuring that
    the WebInspectorUIProxy still exists before calling `attachmentViewDidChange`.

    Currently we are sometimes crashing while attempting to `m_objCAdapter.get()`, which is the first use of a
    member variable in `WebInspectorUIProxy::attachmentViewDidChange`. This retain pointer should never be able to
    not exists, since it storing `nil` is a valid state. This points to the WebInspectorUIProxy itself no longer
    existing. The fix is to check that we actually have a `WebInspectorUIProxy` before calling
    `attachmentViewDidChange`. This is also just good practice since `WebPageProxy::inspector()` is also able to
    return `nullptr` under certain circumstances, and all other calls to it are guarded to check if the
    WebInspectorUIProxy is still around first.

    * UIProcess/Cocoa/WebViewImpl.mm:
    (WebKit::WebViewImpl::setInspectorAttachmentView):

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

Modified Paths

Diff

Modified: branches/safari-613.1.16.1-branch/Source/WebKit/ChangeLog (289390 => 289391)


--- branches/safari-613.1.16.1-branch/Source/WebKit/ChangeLog	2022-02-08 18:55:38 UTC (rev 289390)
+++ branches/safari-613.1.16.1-branch/Source/WebKit/ChangeLog	2022-02-08 18:55:41 UTC (rev 289391)
@@ -1,5 +1,52 @@
 2022-02-08  Alan Coon  <[email protected]>
 
+        Cherry-pick r288848. rdar://problem/86950638
+
+    Web Inspector: [Cocoa] Crash in WebKit::WebInspectorUIProxy::attachmentViewDidChange
+    https://bugs.webkit.org/show_bug.cgi?id=235842
+    
+    Reviewed by Timothy Hatcher.
+    
+    Speculatively fix an occasional crash in WebKit::WebInspectorUIProxy::attachmentViewDidChange by ensuring that
+    the WebInspectorUIProxy still exists before calling `attachmentViewDidChange`.
+    
+    Currently we are sometimes crashing while attempting to `m_objCAdapter.get()`, which is the first use of a
+    member variable in `WebInspectorUIProxy::attachmentViewDidChange`. This retain pointer should never be able to
+    not exists, since it storing `nil` is a valid state. This points to the WebInspectorUIProxy itself no longer
+    existing. The fix is to check that we actually have a `WebInspectorUIProxy` before calling
+    `attachmentViewDidChange`. This is also just good practice since `WebPageProxy::inspector()` is also able to
+    return `nullptr` under certain circumstances, and all other calls to it are guarded to check if the
+    WebInspectorUIProxy is still around first.
+    
+    * UIProcess/Cocoa/WebViewImpl.mm:
+    (WebKit::WebViewImpl::setInspectorAttachmentView):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288848 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-31  Patrick Angle  <[email protected]>
+
+            Web Inspector: [Cocoa] Crash in WebKit::WebInspectorUIProxy::attachmentViewDidChange
+            https://bugs.webkit.org/show_bug.cgi?id=235842
+
+            Reviewed by Timothy Hatcher.
+
+            Speculatively fix an occasional crash in WebKit::WebInspectorUIProxy::attachmentViewDidChange by ensuring that
+            the WebInspectorUIProxy still exists before calling `attachmentViewDidChange`.
+
+            Currently we are sometimes crashing while attempting to `m_objCAdapter.get()`, which is the first use of a
+            member variable in `WebInspectorUIProxy::attachmentViewDidChange`. This retain pointer should never be able to
+            not exists, since it storing `nil` is a valid state. This points to the WebInspectorUIProxy itself no longer
+            existing. The fix is to check that we actually have a `WebInspectorUIProxy` before calling
+            `attachmentViewDidChange`. This is also just good practice since `WebPageProxy::inspector()` is also able to
+            return `nullptr` under certain circumstances, and all other calls to it are guarded to check if the
+            WebInspectorUIProxy is still around first.
+
+            * UIProcess/Cocoa/WebViewImpl.mm:
+            (WebKit::WebViewImpl::setInspectorAttachmentView):
+
+2022-02-08  Alan Coon  <[email protected]>
+
         Cherry-pick r288825. rdar://problem/88172449
 
     [WP] Remove PostScript conversion code

Modified: branches/safari-613.1.16.1-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (289390 => 289391)


--- branches/safari-613.1.16.1-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2022-02-08 18:55:38 UTC (rev 289390)
+++ branches/safari-613.1.16.1-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2022-02-08 18:55:41 UTC (rev 289391)
@@ -4050,7 +4050,9 @@
         return;
 
     m_inspectorAttachmentView = newView;
-    m_page->inspector()->attachmentViewDidChange(oldView ? oldView : m_view.getAutoreleased(), newView ? newView : m_view.getAutoreleased());
+    
+    if (auto* inspector = m_page->inspector())
+        inspector->attachmentViewDidChange(oldView ? oldView : m_view.getAutoreleased(), newView ? newView : m_view.getAutoreleased());
 }
 
 NSView *WebViewImpl::inspectorAttachmentView()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to