Title: [289325] branches/safari-613-branch/Source/WebKit
Revision
289325
Author
[email protected]
Date
2022-02-07 18:56:39 -0800 (Mon, 07 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-branch/Source/WebKit/ChangeLog (289324 => 289325)


--- branches/safari-613-branch/Source/WebKit/ChangeLog	2022-02-08 02:56:36 UTC (rev 289324)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog	2022-02-08 02:56:39 UTC (rev 289325)
@@ -1,5 +1,52 @@
 2022-02-07  Russell Epstein  <[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-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288831. rdar://problem/88268450
 
     [iOS] SharePlay is shown prominently for system-provided Share Sheets

Modified: branches/safari-613-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (289324 => 289325)


--- branches/safari-613-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2022-02-08 02:56:36 UTC (rev 289324)
+++ branches/safari-613-branch/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2022-02-08 02:56:39 UTC (rev 289325)
@@ -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