WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/wil/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -3123,6 +3123,8 @@ namespace details
if (0 == ::InterlockedDecrement(&m_refCount))
{
lock.reset(); // leave the lock before deleting it.
// Make sure callbacks are not running in parallel to destruction.
m_threadPoolWait.reset();
delete this;
}
}
Expand All @@ -3139,7 +3141,7 @@ namespace details
delete this;
// Sleep(1); // Enable for testing to find use after free bugs.
}
else if (rearm)
else if (rearm && m_threadPoolWait.is_valid())
{
::SetThreadpoolWait(m_threadPoolWait.get(), m_eventHandle.get(), nullptr);
}
Expand Down