Branch: refs/heads/webkitglib/2.52
Home: https://github.com/WebKit/WebKit
Commit: 3ed9b57d0094a1675ddb51c45d9a6bb28e62162b
https://github.com/WebKit/WebKit/commit/3ed9b57d0094a1675ddb51c45d9a6bb28e62162b
Author: Ahmad Saleem <[email protected]>
Date: 2026-08-11 (Tue, 11 Aug 2026)
Changed paths:
M Source/WebCore/Modules/webaudio/BaseAudioContext.cpp
Log Message:
-----------
Cherry-pick 318867@main (9f39c1d4c9b0).
https://bugs.webkit.org/show_bug.cgi?id=321367
Unreviewed backport.
BaseAudioContext::clear() leaks AudioNodes marked for deletion during
uninitialize()
https://bugs.webkit.org/show_bug.cgi?id=321367
rdar://184421456
Reviewed by Chris Dumez.
clear() assigned m_nodesMarkedForDeletion over m_nodesToDelete instead of
appending
to it. m_nodesToDelete is not necessarily empty on entry: uninitialize()
sets
m_isAudioThreadFinished before calling
handleDeferredDecrementConnectionCounts() and
handleDeferredDerefs(), and those reach markForDeletion(), which appends
straight to
m_nodesToDelete once the audio thread is finished, without the
deleteMarkedNodes()
call that the public deref() / decrementConnectionCount() wrappers make.
Those nodes
were dropped by the assignment. They are deleted by hand, and each holds a
Ref to its
context, so a single dropped node leaks the whole BaseAudioContext and its
graph.
The loop was dead too: deleteMarkedNodes() drains m_nodesToDelete, so the
condition
was always false and nodes marked while deleting other nodes were never
collected.
Append instead of assign and loop on m_nodesMarkedForDeletion, restoring
the behavior
from before 6eceb6d922f3, which drained before moving.
No test: the deferred lists are only populated when the audio thread failed
a
tryLock() on the graph lock, so this cannot be triggered deterministically.
* Source/WebCore/Modules/webaudio/BaseAudioContext.cpp:
(WebCore::BaseAudioContext::clear):
Canonical link: https://commits.webkit.org/318867@main
Canonical link: https://commits.webkit.org/305877.1088@webkitglib/2.52
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications