File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -189,13 +189,21 @@ struct SC::AsyncEventLoop::KernelQueue
189
189
OVERLAPPED_ENTRY events[totalNumEvents];
190
190
ULONG newEvents = 0 ;
191
191
192
- KernelQueue (Internal&) { memset (events, totalNumEvents, sizeof (events[0 ])); }
192
+ KernelQueue (Internal&) { :: memset (events, 0 , totalNumEvents * sizeof (events[0 ])); }
193
193
194
194
uint32_t getNumEvents () const { return static_cast <uint32_t >(newEvents); }
195
195
196
196
[[nodiscard]] AsyncRequest* getAsyncRequest (uint32_t index)
197
197
{
198
198
OVERLAPPED_ENTRY& event = events[index];
199
+ if (event.lpOverlapped == nullptr )
200
+ {
201
+ // On Windows 10 GetQueuedCompletionStatusEx reports 1 removed entry when called on
202
+ // an Completion Port that has nothing scheduled on it.
203
+ // This happens for example during first creation of the event loop, with the runNoWait
204
+ // that is executed after createSharedWatchers()
205
+ return nullptr ;
206
+ }
199
207
return detail::AsyncWinOverlapped::getUserDataFromOverlapped<AsyncRequest>(event.lpOverlapped );
200
208
}
201
209
You can’t perform that action at this time.
0 commit comments