Skip to content

Commit bc53de1

Browse files
Fix 'offline renderer' thread cleanup
Offline renderer thread in most of the cases doesn't clean up its resources. Thread should be joined on every exit, not only when rendering process is in progress. This problem was detected during webaudio testing which revealed memory leakage.
1 parent 5b8829b commit bc53de1

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ void OfflineAudioDestinationNode::uninitialize()
8686
return;
8787

8888
if (m_startedRendering) {
89-
if (m_renderThread) {
90-
m_renderThread->waitForCompletion();
91-
m_renderThread = nullptr;
92-
}
9389
if (auto* workletProxy = context().audioWorklet().proxy()) {
9490
BinarySemaphore semaphore;
9591
workletProxy->postTaskForModeToWorkletGlobalScope([&semaphore](ScriptExecutionContext&) mutable {
@@ -99,6 +95,11 @@ void OfflineAudioDestinationNode::uninitialize()
9995
}
10096
}
10197

98+
if (m_renderThread) {
99+
m_renderThread->waitForCompletion();
100+
m_renderThread = nullptr;
101+
}
102+
102103
AudioNode::uninitialize();
103104
}
104105

0 commit comments

Comments
 (0)