Skip to content

Commit

Permalink
Merge pull request #336 from altmp/feature/js-timers-leak
Browse files Browse the repository at this point in the history
Fix js-module timers leak
  • Loading branch information
vadzz-dev authored Dec 16, 2024
2 parents 5d9f68b + e8744d8 commit 7b6b4ae
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion shared/V8ResourceImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,16 @@ void V8ResourceImpl::OnTick()
for(auto& nextTickCb : nextTickCallbacks) nextTickCb();
nextTickCallbacks.clear();

for(auto& id : oldTimers) timers.erase(id);
for(auto& id : oldTimers)
{
auto it = timers.find(id);
if(it == timers.end())
continue;

auto timer = it->second;
timers.erase(it);
delete timer;
}

oldTimers.clear();

Expand Down

0 comments on commit 7b6b4ae

Please sign in to comment.