Fix decrementing the waiter count when destroying a WinAPI event with active waiters.

This commit is contained in:
Sönke Ludwig 2017-11-20 22:19:00 +01:00
parent fdeef38ef4
commit 3352423414

View file

@ -110,6 +110,10 @@ final class WinAPIEventDriverEvents : EventDriverEvents {
auto pe = descriptor in m_events;
assert(pe.refCount > 0);
if (--pe.refCount == 0) {
// make sure to not leak any waiter references for pending waits
foreach (i; 0 .. pe.waiters.length)
m_core.removeWaiter();
() @trusted nothrow {
scope (failure) assert(false);
destroy(pe.waiters);