Skip to content

Commit

Permalink
Only use CheckedPtr on the stack with RemoteWebInspectorUIProxyClient
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=266797

Reviewed by Ryosuke Niwa.

* Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.cpp:
(WebKit::RemoteWebInspectorUIProxy::frontendDidClose):
(WebKit::RemoteWebInspectorUIProxy::sendMessageToBackend):
* Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.h:

Canonical link: https://commits.webkit.org/272584@main
  • Loading branch information
cdumez committed Jan 2, 2024
1 parent 9bfed8c commit 127a6cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void RemoteWebInspectorUIProxy::frontendDidClose()
{
Ref<RemoteWebInspectorUIProxy> protect(*this);

if (CheckedPtr client = m_client)
if (CheckedPtr client = m_client.get())
client->closeFromFrontend();

closeFrontendPageAndWindow();
Expand Down Expand Up @@ -207,7 +207,7 @@ void RemoteWebInspectorUIProxy::setInspectorPageDeveloperExtrasEnabled(bool enab

void RemoteWebInspectorUIProxy::sendMessageToBackend(const String& message)
{
if (CheckedPtr client = m_client)
if (CheckedPtr client = m_client.get())
client->sendMessageToBackend(message);
}

Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class WebView;
class WebInspectorUIExtensionControllerProxy;
#endif

class RemoteWebInspectorUIProxyClient : public CanMakeCheckedPtr {
class RemoteWebInspectorUIProxyClient : public CanMakeWeakPtr<RemoteWebInspectorUIProxyClient>, public CanMakeCheckedPtr {
public:
virtual ~RemoteWebInspectorUIProxyClient() { }
virtual void sendMessageToBackend(const String& message) = 0;
Expand Down Expand Up @@ -166,7 +166,7 @@ class RemoteWebInspectorUIProxy : public RefCounted<RemoteWebInspectorUIProxy>,
void platformRevealFileExternally(const String& path);
void platformShowCertificate(const WebCore::CertificateInfo&);

CheckedPtr<RemoteWebInspectorUIProxyClient> m_client;
WeakPtr<RemoteWebInspectorUIProxyClient> m_client;
WeakPtr<WebPageProxy> m_inspectorPage;

#if ENABLE(INSPECTOR_EXTENSIONS)
Expand Down

0 comments on commit 127a6cc

Please sign in to comment.