Fix a crash in SerialIoHandler.
When a receive error occurs, the SerialConnection pauses receives, which triggers a call to CancelRead(). This should be a no-op as this occurs after the previous read completed with an error, but pending_read_buffer_ isn't cleared until after the error is reported to SerialConnection. Thus, on posix, a call to ReadDone is enqueued, but the pending read is cleared before it runs, leading to a crash. This change clears pending_read_buffer_ and pending_write_buffer_ before calling Done() or DoneWithError(). BUG=410331 Review URL: https://codereview.chromium.org/551713002 Cr-Commit-Position: refs/heads/master@{#293684}
Showing
Please register or sign in to comment