Skip to content

Commit b7b9efb

Browse files
committed
patch 8.1.1671: copying a blob may result in it being locked
Problem: Copying a blob may result in it being locked. Solution: Reset v_lock. (Ken Takata, closes #4648)
1 parent 0231f83 commit b7b9efb

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/blob.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ blob_copy(typval_T *from, typval_T *to)
6363
int ret = OK;
6464

6565
to->v_type = VAR_BLOB;
66+
to->v_lock = 0;
6667
if (from->vval.v_blob == NULL)
6768
to->vval.v_blob = NULL;
6869
else if (rettv_blob_alloc(to) == FAIL)

src/testdir/test_blob.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ func Test_blob_assign()
7171
call assert_fails('let b .= "xx"', 'E734:')
7272
call assert_fails('let b += "xx"', 'E734:')
7373
call assert_fails('let b[1:1] .= 0z55', 'E734:')
74+
75+
let l = [0z12]
76+
let m = deepcopy(l)
77+
let m[0] = 0z34 " E742 or E741 should not occur.
7478
endfunc
7579

7680
func Test_blob_get_range()

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,8 @@ static char *(features[]) =
777777

778778
static int included_patches[] =
779779
{ /* Add new patch number below this line */
780+
/**/
781+
1671,
780782
/**/
781783
1670,
782784
/**/

0 commit comments

Comments
 (0)