Remove async cleanup hooks from the list after they're called, not before

This commit is contained in:
Kai Tamkun
2024-11-14 17:57:52 -08:00
parent 4103b738ff
commit 2aee62382f

View File

@@ -84,10 +84,10 @@ public:
while (!m_asyncCleanupHooks.empty()) {
auto [function, data, handle] = m_asyncCleanupHooks.back();
m_asyncCleanupHooks.pop_back();
ASSERT(function != nullptr);
function(handle, data);
delete handle;
m_asyncCleanupHooks.pop_back();
}
for (const BoundFinalizer& boundFinalizer : m_finalizers) {