To: vim_dev@googlegroups.com Subject: Patch 9.0.1202 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1202 Problem: Crash when iterating over list of objects. Solution: Do not make a copy of tt_member for object or class. (closes #11823) Files: src/vim9type.c, src/testdir/test_vim9_class.vim *** ../vim-9.0.1201/src/vim9type.c 2023-01-12 20:39:05.864616570 +0000 --- src/vim9type.c 2023-01-15 16:49:43.950425012 +0000 *************** *** 86,92 **** ((type_T **)seen_types->ga_data)[seen_types->ga_len * 2 + 1] = copy; ++seen_types->ga_len; ! if (copy->tt_member != NULL) copy->tt_member = copy_type_deep_rec(copy->tt_member, type_gap, seen_types); --- 86,93 ---- ((type_T **)seen_types->ga_data)[seen_types->ga_len * 2 + 1] = copy; ++seen_types->ga_len; ! if (copy->tt_member != NULL ! && copy->tt_type != VAR_OBJECT && copy->tt_type != VAR_CLASS) copy->tt_member = copy_type_deep_rec(copy->tt_member, type_gap, seen_types); *** ../vim-9.0.1201/src/testdir/test_vim9_class.vim 2023-01-15 15:51:44.078750474 +0000 --- src/testdir/test_vim9_class.vim 2023-01-15 16:52:14.046454062 +0000 *************** *** 219,224 **** --- 219,245 ---- v9.CheckScriptSuccess(lines) enddef + def Test_list_of_objects() + var lines =<< trim END + vim9script + + class Foo + def Add() + enddef + endclass + + def ProcessList(fooList: list) + for foo in fooList + foo.Add() + endfor + enddef + + var l: list = [Foo.new()] + ProcessList(l) + END + v9.CheckScriptSuccess(lines) + enddef + def Test_class_default_new() var lines =<< trim END vim9script *** ../vim-9.0.1201/src/version.c 2023-01-15 15:51:44.082750474 +0000 --- src/version.c 2023-01-15 16:50:50.910438548 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1202, /**/ -- hundred-and-one symptoms of being an internet addict: 17. You turn on your intercom when leaving the room so you can hear if new e-mail arrives. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///