When passing same Dictionary/List to expand(), it breaks reference counter.

let o = {"a":{"b":"B"}}
call  extend(o, o)
echo o.a.b <= crash

https://gist.github.com/2578755

Please check and include.

diff -r 8201108e9cf0 src/eval.c
--- a/src/eval.c        Tue May 01 21:14:34 2012 +0200
+++ b/src/eval.c        Thu May 03 03:00:30 2012 +0900
@@ -10110,7 +10110,7 @@
        l1 = argvars[0].vval.v_list;
        l2 = argvars[1].vval.v_list;
        if (l1 != NULL && !tv_check_lock(l1->lv_lock, (char_u *)_(arg_errmsg))
-               && l2 != NULL)
+               && l2 != NULL && l1 != l2)
        {
            if (argvars[2].v_type != VAR_UNKNOWN)
            {
@@ -10149,7 +10149,7 @@
        d1 = argvars[0].vval.v_dict;
        d2 = argvars[1].vval.v_dict;
        if (d1 != NULL && !tv_check_lock(d1->dv_lock, (char_u *)_(arg_errmsg))
-               && d2 != NULL)
+               && d2 != NULL && d1 != d2)
        {
            /* Check the third argument. */
            if (argvars[2].v_type != VAR_UNKNOWN)
@@ -10191,7 +10191,7 @@
                        EMSG2(_("E737: Key already exists: %s"), hi2->hi_key);
                        break;
                    }
-                   else if (*action == 'f')
+                   else if (*action == 'f' && HI2DI(hi2) != di1)
                    {
                        clear_tv(&di1->di_tv);
                        copy_tv(&HI2DI(hi2)->di_tv, &di1->di_tv);

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui