Skip to content

Commit

Permalink
Merge test from trunk. Fix string rep invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
apnadkarni committed Jun 6, 2024
2 parents b9b7405 + 5cac4c9 commit 44fcef4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 6 additions & 6 deletions generic/threadSvListCmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions tests/tsv.test
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 44fcef4

Please sign in to comment.