diff --git a/generic/threadSvListCmd.c b/generic/threadSvListCmd.c index 41cede2..bca1d9c 100644 --- a/generic/threadSvListCmd.c +++ b/generic/threadSvListCmd.c @@ -1001,6 +1001,12 @@ SvLsetFlat( break; } + /* + * Remember list of Tcl_Objs that need invalidation of string reps. + */ + pendingInvalidatesPtr[numPendingInvalidates] = listPtr; + ++numPendingInvalidates; + /* * Break the loop after extracting the innermost sublist */ @@ -1010,12 +1016,6 @@ SvLsetFlat( break; } - /* - * Extract the appropriate sublist and chain it onto the linked - * list of Tcl_Obj's whose string reps must be spoilt. - */ - pendingInvalidatesPtr[numPendingInvalidates] = listPtr; - ++numPendingInvalidates; subListPtr = elemPtrs[index]; listPtr = subListPtr; diff --git a/tests/tsv.test b/tests/tsv.test index 3509c87..feaa0ba 100644 --- a/tests/tsv.test +++ b/tests/tsv.test @@ -104,4 +104,9 @@ foreach backend $backends { file delete -force $db } +test tsv-bug-c2dfd8b7ea {tsv::lset crash} -body { + tsv::linsert mytsv mylist 0 A {X Y} + tsv::lset mytsv mylist end 1 P +} -result {A {X P}} + ::tcltest::cleanupTests