From 6d8bb8ce13fb954eafd80f7912d71787ea8447ad Mon Sep 17 00:00:00 2001 From: Chirag M Shah Date: Fri, 17 Mar 2023 18:49:41 -0700 Subject: [PATCH] Cherry-pick 261817@main (52c77eeabac7). https://bugs.webkit.org/show_bug.cgi?id=254045 Fix smart pointer usage when dealing with ScriptExecutionContext https://bugs.webkit.org/show_bug.cgi?id=254045 rdar://106721110 Reviewed by Ryosuke Niwa. This change fixes uses of ScriptExecutionContext so that it conforms with the smart pointer usage guidelines. * Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h: Canonical link: https://commits.webkit.org/261817@main --- Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h b/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h index de3af9146370..3885c659aa1a 100644 --- a/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h +++ b/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h @@ -30,6 +30,7 @@ #include "ContextDestructionObserver.h" #include "EventTarget.h" #include "PlatformSpeechSynthesisUtterance.h" +#include "ScriptExecutionContext.h" #include "SpeechSynthesisErrorCode.h" #include "SpeechSynthesisVoice.h" #include @@ -80,14 +81,14 @@ class WEBCORE_EXPORT SpeechSynthesisUtterance final : public PlatformSpeechSynth private: SpeechSynthesisUtterance(ScriptExecutionContext&, const String&, UtteranceCompletionHandler&&); - ScriptExecutionContext* scriptExecutionContext() const final { return &m_scriptExecutionContext; } + ScriptExecutionContext* scriptExecutionContext() const final { return m_scriptExecutionContext.get(); } EventTargetInterface eventTargetInterface() const final { return SpeechSynthesisUtteranceEventTargetInterfaceType; } void refEventTarget() final { ref(); } void derefEventTarget() final { deref(); } RefPtr m_platformUtterance; RefPtr m_voice; - ScriptExecutionContext& m_scriptExecutionContext; + WeakPtr m_scriptExecutionContext; UtteranceCompletionHandler m_completionHandler; };