Dominique Pelle wrote:

> >> Vim-7.2.108 can read and write beyond allocated memory when
> >> using autocmd VimResized. Bug happens if a shell command is
> >> used in VimResized autocmd such as...
> >>
> >>   :au! VimResized * sil !echo -ne "\033]12;green\007"
> >>
> >> With this autocmd, I observe the following error with valgrind
> >> when resizing the screen with the mouse:
> 
> ...snip...
> 
> > Thanks.  Not sure if the solution is OK, will have to check that.
> > What if the autocommand relies on the screen already being allocated?
> > This is tricky stuff.
> 
> 
> I think it's OK, but it's tricky as you say.
> 
> An alternative way to fix it, is to check, after applying the autocmd,
> whether Rows or Columns have changed as a result of applying
> the autocmds, and if so  (which is rare) then re-allocate the screen
> again before returning from screenalloc().
> 
> The new attached patch does just that.
> 
> Of course, there might be a risk of endless loop if  an autocmd
> changed Rows and Columns every time.  So the patch puts a
> guard to avoid re-allocating screen more than 3 times.  In practice,
> I observe that it's reallocating sometimes once, rarely twice and
> I do no see more than that.
> 
> Both patches fix the errors that I see with valgrind.

Thanks.  I think this solution is better.  One can write a VimResized
command that applies some restrict to the size, thus changes 'lines' or
'columns' to a limit value.  That should work OK now.

-- 
>From "know your smileys":
 :-*    A big kiss!

 /// Bram Moolenaar -- [email protected] -- 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