francisco Lopes wrote:

> some more info originally from 
> https://github.com/Valloric/YouCompleteMe/issues/618#issuecomment-27265698:
> 
> @Valloric my real advice is that, they should run it, 
> as soon as this get fixed upstream, 
> this is a plain bug as can be checked in the vim thread.
> I've debugged it a bit more and got more info, 
> I've figured out syntastic was related and indeed, 
> disabling it avoided the buggy situation, the thing is 
> that while tabbing a `:redraw` is issued from syntastic's `s:Redraw()` 
> and also, the displaying of the popup menu is issued through 
> the insert completion functionality. The mess happens in 
> `popupmnu.c`, where there's a global variable `pum_first`, 
> this pum_first gets changed both by the drawing issued by 
> insert completion and by a `:redraw` (from `s:Redraw()`) 
> that ends up calling `void pum_redraw()`.
> 
>  At some point, because of this:
> 
>           if (pum_first > pum_selected - context)
>           {
>               /* scroll down */
>               pum_first = pum_selected - context;
>               if (pum_first < 0)
>                   pum_first = 0;
>           }
> 
> `pum_first` starts to get values greater than 0, and keeps 
> this value, once `pum_redraw` is called, the segmentation 
> fault situation is triggered as the `idx` variable used for 
> indexing an array in `pum_redraw` will start to index beyond 
> array bounds.
> 
> So, a lame workaround would be to avoid extra redraws that 
> ends up inherenting state from other popup menu drawing 
> until this state (the `pum_first` global variable) gets 
> reset to its default state.
> 
> I can only say this is messy, and can only blame Vim codebase.

It appears the problem is that pum_first and pum_height are out of sync.
pum_first is corrected only after the code that causes a redraw for the
preview window.

Please verify the patch below also fixes the crash.  It's better in the
sense that it corrects pum_first, instead of displaying the wrong items
and then aborting when going past the end of pum_array.

*** ../vim-7.4.052/src/popupmnu.c       2011-08-17 18:04:28.000000000 +0200
--- src/popupmnu.c      2013-11-02 04:01:06.000000000 +0100
***************
*** 282,287 ****
--- 282,291 ----
      int               round;
      int               n;
  
+     /* Never display more than we have */
+     if (pum_first > pum_size - pum_height)
+       pum_first = pum_size - pum_height;
+ 
      if (pum_scrollbar)
      {
        thumb_heigth = pum_height * pum_height / pum_size;
***************
*** 672,681 ****
  #endif
      }
  
-     /* Never display more than we have */
-     if (pum_first > pum_size - pum_height)
-       pum_first = pum_size - pum_height;
- 
      if (!resized)
        pum_redraw();
  
--- 676,681 ----


-- 
BEDEVERE: How do you know so much about swallows?
ARTHUR:   Well you have to know these things when you're a king, you know.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui