Subject: Re: Segfault on completion with interactive mode
From: Bart Schaefer <[email-masked]>
To: [email-masked]
Date: Fri, 12 Feb 2016 02:17:38 -0800
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Feb 11, 12:49pm, Peter Stephenson wrote:
} Subject: Re: Segfault on completion with interactive mode
}
} What I saw when I tried this was a crash in singledraw() because
} mgtab[0] was 1, suggesting it as a "marked" null pointer.  So presumably
} this state is incompatible with state required when we call
} singledraw(),

Yes, I saw that as well.

} This appears to be a lot later than anything you're talking about.
 
The long description in my previous message was the result of several
(dozen) passes trying to track down WHY we arrive in singledraw() with
mgtab[0] = 1 in the case of

    zstyle ':completion:*:warnings' format '%BNo matching %b%d'

when the analogous case WITHOUT that style works exactly as designed.

The answer to "why?" appears to be that "compadd -x" has clobbered the
completion groups when displaying the warning.  Thus I believe that we
somehow need to save and restore state around the "compadd -x".  The
right place to do that seems to be in domenuselect() in the branch
that uses showinglist = -2, because it's that call to zrefresh() that
ultimately calls the hookdef that eventually does the "compadd -x".