To: vim_dev@googlegroups.com Subject: Patch 8.1.0167 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0167 Problem: Lock flag in new dictitem is reset in many places. Solution: Always reset the lock flag. Files: src/dict.c, src/channel.c, src/ex_cmds2.c, src/userfunc.c, src/if_perl.xs, src/if_py_both.h *** ../vim-8.1.0166/src/dict.c Sun Jul 8 16:50:33 2018 --- src/dict.c Sun Jul 8 17:06:50 2018 *************** *** 188,194 **** /* * Allocate a Dictionary item. * The "key" is copied to the new item. ! * Note that the value of the item "di_tv" still needs to be initialized! * Returns NULL when out of memory. */ dictitem_T * --- 188,195 ---- /* * Allocate a Dictionary item. * The "key" is copied to the new item. ! * Note that the type and value of the item "di_tv" still needs to be ! * initialized! * Returns NULL when out of memory. */ dictitem_T * *************** *** 201,206 **** --- 202,208 ---- { STRCPY(di->di_key, key); di->di_flags = DI_FLAGS_ALLOC; + di->di_tv.v_lock = 0; } return di; } *************** *** 338,344 **** item = dictitem_alloc((char_u *)key); if (item == NULL) return FAIL; - item->di_tv.v_lock = 0; item->di_tv.v_type = VAR_NUMBER; item->di_tv.vval.v_number = nr; if (dict_add(d, item) == FAIL) --- 340,345 ---- *************** *** 361,367 **** item = dictitem_alloc((char_u *)key); if (item == NULL) return FAIL; - item->di_tv.v_lock = 0; item->di_tv.v_type = VAR_STRING; item->di_tv.vval.v_string = str != NULL ? vim_strsave(str) : NULL; if (dict_add(d, item) == FAIL) --- 362,367 ---- *************** *** 384,390 **** item = dictitem_alloc((char_u *)key); if (item == NULL) return FAIL; - item->di_tv.v_lock = 0; item->di_tv.v_type = VAR_LIST; item->di_tv.vval.v_list = list; ++list->lv_refcount; --- 384,389 ---- *************** *** 408,414 **** item = dictitem_alloc((char_u *)key); if (item == NULL) return FAIL; - item->di_tv.v_lock = 0; item->di_tv.v_type = VAR_DICT; item->di_tv.vval.v_dict = dict; ++dict->dv_refcount; --- 407,412 ---- *** ../vim-8.1.0166/src/channel.c Sun Jul 8 16:50:33 2018 --- src/channel.c Sun Jul 8 17:05:44 2018 *************** *** 5742,5748 **** item = dictitem_alloc((char_u *)"channel"); if (item == NULL) return; - item->di_tv.v_lock = 0; item->di_tv.v_type = VAR_CHANNEL; item->di_tv.vval.v_channel = job->jv_channel; if (job->jv_channel != NULL) --- 5742,5747 ---- *** ../vim-8.1.0166/src/ex_cmds2.c Sun Jul 8 16:50:33 2018 --- src/ex_cmds2.c Sun Jul 8 17:07:59 2018 *************** *** 1524,1530 **** di->di_tv.v_type = VAR_FUNC; di->di_tv.vval.v_string = vim_strsave(timer->tr_callback); } - di->di_tv.v_lock = 0; } } --- 1524,1529 ---- *** ../vim-8.1.0166/src/userfunc.c Sat Jun 30 18:27:59 2018 --- src/userfunc.c Sun Jul 8 17:10:33 2018 *************** *** 2390,2396 **** /* overwrite existing dict entry */ clear_tv(&fudi.fd_di->di_tv); fudi.fd_di->di_tv.v_type = VAR_FUNC; - fudi.fd_di->di_tv.v_lock = 0; fudi.fd_di->di_tv.vval.v_string = vim_strsave(name); /* behave like "dict" was used */ --- 2390,2395 ---- *** ../vim-8.1.0166/src/if_perl.xs Tue Mar 6 12:22:50 2018 --- src/if_perl.xs Sun Jul 8 17:11:10 2018 *************** *** 1200,1209 **** if ((item = dictitem_alloc((char_u *)key)) == NULL) break; ! ! item->di_tv.v_type = VAR_NUMBER; ! item->di_tv.v_lock = 0; ! item->di_tv.vval.v_number = 0; if (dict_add(dict, item) == FAIL) { dictitem_free(item); --- 1200,1207 ---- if ((item = dictitem_alloc((char_u *)key)) == NULL) break; ! item->di_tv.v_type = VAR_NUMBER; ! item->di_tv.vval.v_number = 0; if (dict_add(dict, item) == FAIL) { dictitem_free(item); *** ../vim-8.1.0166/src/if_py_both.h Sun Jun 10 13:55:48 2018 --- src/if_py_both.h Sun Jul 8 17:12:13 2018 *************** *** 1832,1838 **** PyErr_NoMemory(); return -1; } - di->di_tv.v_lock = 0; di->di_tv.v_type = VAR_UNKNOWN; if (dict_add(dict, di) == FAIL) --- 1832,1837 ---- *************** *** 2038,2044 **** PyErr_NoMemory(); return NULL; } - di->di_tv.v_lock = 0; di->di_tv.v_type = VAR_UNKNOWN; valObject = PySequence_Fast_GET_ITEM(fast, 1); --- 2037,2042 ---- *************** *** 5852,5858 **** dict_unref(dict); return -1; } - di->di_tv.v_lock = 0; if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1) { --- 5850,5855 ---- *************** *** 5950,5956 **** PyErr_NoMemory(); return -1; } - di->di_tv.v_lock = 0; if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1) { --- 5947,5952 ---- *** ../vim-8.1.0166/src/version.c Sun Jul 8 16:50:33 2018 --- src/version.c Sun Jul 8 17:18:05 2018 *************** *** 791,792 **** --- 791,794 ---- { /* Add new patch number below this line */ + /**/ + 167, /**/ -- hundred-and-one symptoms of being an internet addict: 208. Your goals for the future are obtaining an T1 connection and a 130 gig hard drive. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///