Subject: Another segfault demo test, this one with [close] during [gets].

From: dgp <[email-masked]>
Date: Wed, 30 Apr 2014 19:12:37 +0000

---
 tests/ioCmd.test | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index 8bf32d2..d2c0173 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -806,6 +806,22 @@ test iocmd-21.22 {[close] in [read] segfaults} -setup {
     catch {close $ch}
     rename foo {}
 } -match glob -result {*invalid argument*}
+test iocmd-21.23 {[close] in [gets] segfaults} -setup {
+    proc foo {method chan args} {
+	switch -- $method initialize {
+	    return {initialize finalize watch read}
+	} finalize {} watch {} read {
+	    catch {close $chan}
+	    return \n
+	}
+    }
+    set ch [chan create read foo]
+} -body {
+    gets $ch
+} -returnCodes error -cleanup {
+    catch {close $ch}
+    rename foo {}
+} -match glob -result {*invalid argument*}
 
 # --- --- --- --------- --------- ---------
 # Helper commands to record the arguments to handler methods.
-- 
cgit v0.12