aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jim-aio.c9
-rw-r--r--regtest.tcl7
2 files changed, 16 insertions, 0 deletions
diff --git a/jim-aio.c b/jim-aio.c
index e25af18..0f150b5 100644
--- a/jim-aio.c
+++ b/jim-aio.c
@@ -1170,6 +1170,15 @@ static int aio_cmd_puts(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
/* Keep it simple and always go via the writebuf instead of trying to optimise
* the case that we can write immediately
*/
+#ifdef JIM_MAINTAINER
+ if (Jim_IsShared(af->writebuf)) {
+ /* This should generally never happen since this object isn't accessible,
+ * but it is possible with 'debug objects' */
+ Jim_DecrRefCount(interp, af->writebuf);
+ af->writebuf = Jim_DuplicateObj(interp, af->writebuf);
+ Jim_IncrRefCount(af->writebuf);
+ }
+#endif
Jim_AppendObj(interp, af->writebuf, strObj);
if (nl) {
Jim_AppendString(interp, af->writebuf, "\n", 1);
diff --git a/regtest.tcl b/regtest.tcl
index 5e66aa3..99a65fe 100644
--- a/regtest.tcl
+++ b/regtest.tcl
@@ -399,6 +399,13 @@ set json {
catch {json::decode $json}
puts "TEST 56 PASSED"
+if {[exists -command debug]} {
+ set f [open /dev/null w]
+ $f puts [debug objects]
+ $f close
+}
+puts "TEST 57 PASSED"
+
# TAKE THE FOLLOWING puts AS LAST LINE
puts "--- ALL TESTS PASSED ---"