summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-08-19 19:07:17 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-08-19 19:07:17 (GMT)
commitb4307ec076f504b43a12901bb34c646ea5267391 (patch)
tree92deb26629aacc8365e068d9b1361fc527393f3a
parentc7308459febcf0a9d4fd00a1522a33b0fe6fa74b (diff)
downloadtcl-b4307ec076f504b43a12901bb34c646ea5267391.zip
tcl-b4307ec076f504b43a12901bb34c646ea5267391.tar.gz
tcl-b4307ec076f504b43a12901bb34c646ea5267391.tar.bz2
3394654, 3393276 Revise FlushChannel() to account for the possibility
that the ChanWrite() call might recycle the buffer out from under us.
-rw-r--r--ChangeLog4
-rw-r--r--generic/tclIO.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8cbc045..db4bf84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2011-08-19 Don Porter <dgp@users.sourceforge.net>
+ * generic/tclIO.c: [Bugs 3394654, 3393276] Revise FlushChannel() to
+ account for the possibility that the ChanWrite() call might recycle
+ the buffer out from under us.
+
* generic/tclIO.c: Preserve the chanPtr during FlushChannel so that
channel drivers don't yank it away before we're done with it.
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 946b53a..ae1b89a 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -2510,7 +2510,9 @@ FlushChannel(
wroteSome = 1;
}
- bufPtr->nextRemoved += written;
+ if (!IsBufferEmpty(bufPtr)) {
+ bufPtr->nextRemoved += written;
+ }
/*
* If this buffer is now empty, recycle it.