Title: [288848] trunk/Source/WebKit
- Revision
- 288848
- Author
- [email protected]
- Date
- 2022-01-31 15:04:08 -0800 (Mon, 31 Jan 2022)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (288847 => 288848)
--- trunk/Source/WebKit/ChangeLog 2022-01-31 22:52:12 UTC (rev 288847)
+++ trunk/Source/WebKit/ChangeLog 2022-01-31 23:04:08 UTC (rev 288848)
@@ -1,3 +1,24 @@
+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-01-31 Said Abou-Hallawa <[email protected]>
[GPU Process] Remove the resource use counters from the remote resource cache
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (288847 => 288848)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2022-01-31 22:52:12 UTC (rev 288847)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2022-01-31 23:04:08 UTC (rev 288848)
@@ -4029,7 +4029,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