Francisco Lopes wrote:

> I've applied the following patch to pum_redraw function to avoid rare 
> segfaults I was suffering.
> 
> diff -r 92c9748e0ccb src/popupmnu.c
> --- a/src/popupmnu.c  Sun Oct 06 17:46:56 2013 +0200
> +++ b/src/popupmnu.c  Mon Oct 21 12:29:31 2013 -0200
> @@ -295,6 +295,8 @@
>      for (i = 0; i < pum_height; ++i)
>      {
>       idx = i + pum_first;
> +     if(idx >= pum_height)
> +         break;
>       attr = (idx == pum_selected) ? attr_select : attr_norm;
>  
>       /* prepend a space if there is room */
> 
> I've discovered the situation while debugging
> https://github.com/Valloric/YouCompleteMe/issues/593 but I'm unable to
> explain all the characteristics that leads to the segfault situation
> (that happens only occasionally). I just verified that idx was getting
> beyond pum_height in the last step of the loop, and this was a problem
> when accessing pum_array[idx], for example, referencing invalid
> memory.

Thanks for the patch.  It would be good if you at least have an idea why
this happens.  Perhaps pum_first is changed inside the loop?


-- 
Two cows are standing together in a field.  One asks the other:
"So what do you think about this Mad Cow Disease?"
The other replies: "That doesn't concern me. I'm a helicopter."

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