Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

After calling CancelIo, wait for all IO operations to finish before closing handles and freeing OVERLAPPED structures. #21

Merged
merged 1 commit into from

2 participants

@roniegh

This fixes a bug found by Kusti, where a stack corruption could occur when an OVERLAPPED structure is released before all IO operations are finished.

@nyholku nyholku merged commit ac58f52 into nyholku:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 2, 2013
  1. @roniegh

    After calling CancelIo, wait for all IO operations to finish before c…

    roniegh authored
    …losing handles and freeing OVERLAPPED structures.
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/jtermios/windows/JTermiosImpl.java
View
5 src/jtermios/windows/JTermiosImpl.java
@@ -157,7 +157,12 @@ public void close() {
log = log && log(1, "CancelIo() failed, GetLastError()= %d, %s\n", GetLastError(), lineno(1));
if (!PurgeComm(m_Comm, PURGE_TXABORT + PURGE_TXCLEAR + PURGE_RXABORT + PURGE_RXCLEAR))
log = log && log(1, "PurgeComm() failed, GetLastError()= %d, %s\n", GetLastError(), lineno(1));
+
+ GetOverlappedResult(m_Comm, m_RdOVL, m_RdN, true);
+ GetOverlappedResult(m_Comm, m_WrOVL, m_WrN, true);
+ GetOverlappedResult(m_Comm, m_SelOVL, m_SelN, true);
}
+
HANDLE h; // / 'hEvent' might never have been 'read' so read it
// to this var first
Something went wrong with that request. Please try again.