Dominique Pelle wrote:

> Bram Moolenaar skribis:
> 
>  >>> Matt Wozniski wrote:
> >> >>>
> >> >>>> function! ReturnArgs(...)
> >> >>>>    return a:000
> >> >>>> endfunction
> >> >>>>
> >> >>>> " Seems to work fine?
> >> >>>> echo ReturnArgs(1, 2, 3)
> >> >>>>
> >> >>>> " SEGV
> >> >>>> echo string(ReturnArgs(1, 2, 3))
> >> >>>>
> >> >>>> function! MakeArgsDict(...)
> >> >>>>    return { 'args': a:000 }
> >> >>>> endfunction
> >> >>>>
> >> >>>> " E685 Internal Error
> >> >>>> echo MakeArgsDict(1, 2, 3)
> >> >>>>
> >> >>>> " SEGV
> >> >>>> echo string(MakeArgsDict(1, 2, 3))
> >> >>> For it crashes a while after trying these things.  Most likely the
> >> >>> reference count for a:000 is wrong.  Never thought of someone returning
> >> >>> it...
> >
> > [...]
> >
> > I have made a patch to fix this.  It's complicated stuff, I hope I
> > thought of everything that could possibly go wrong, including memory
> > leaks.
> >
> > Dominique, can you try including the patch and running valgrind?  And
> > check for memory leaks?
> 
> 
> It looks good to me.  Patch fixes the bug and I can't see any error
> or leak with valgrind memory checker.  I tried all test cases reported
> by Matt Wozniski, as well as "make test" (all tests passed).

Thanks for checking this.  I'll have last look at it and send it out
soon.

-- 
ARTHUR:  No, hang on!  Just answer the five questions ...
GALAHAD: Three questions ...
ARTHUR:  Three questions ...  And we shall watch ... and pray.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui