Skip to content

Commit

Permalink
[CI]: Fix random segmentation fault during event handling (#9010)
Browse files Browse the repository at this point in the history
* Fix random segmentation fault during event handling

* Update for review comment
  • Loading branch information
yufengwangca authored Aug 18, 2021
1 parent 6ef58ba commit 26c0e35
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/system/WatchableEventManagerSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,16 @@ void WatchableEventManager::HandleEvents()
watchable->SetPendingIO(
SocketEventsFromFDs(watchable->GetFD(), mSelected.mReadSet, mSelected.mWriteSet, mSelected.mErrorSet));
}
for (WatchableSocket * watchable = mAttachedSockets; watchable != nullptr; watchable = watchable->mAttachedNext)

WatchableSocket * nextWatchableSocket = mAttachedSockets;
while (nextWatchableSocket != nullptr)
{
if (watchable->mPendingIO.HasAny())
WatchableSocket * currentWatchable = nextWatchableSocket;
nextWatchableSocket = nextWatchableSocket->mAttachedNext;

if (currentWatchable->mPendingIO.HasAny())
{
watchable->InvokeCallback();
currentWatchable->InvokeCallback();
}
}

Expand Down

0 comments on commit 26c0e35

Please sign in to comment.