Subject: Re: Segfault on completion with interactive mode
From: Peter Stephenson <[email-masked]>
To: [email-masked]
Date: Thu, 11 Feb 2016 12:49:48 +0000
List-Id: Zsh Workers List <zsh-workers.zsh.org>

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(),

    if (!mnew && inselect && onlnct == nlnct && mlbeg >= 0 && mlbeg == molbeg)
        singledraw();

This appears to be a lot later than anything you're talking about.

Preumably that pile of stuff in complistmatches inside "if (mnew) {" is
the key to what should be consistent.  It sounds like in the code you're
talking about, that code had just run, because mtab_been_reallocated was
1, whereas this time round, when it crashes, it hadn't.
("mtab_been_reallocated" seems to be associated with the 'if you've got
global variables you don't really need a calling convention' programming
style.)

So at the level I'm looking at it, it looks vaguely like it's in a state
as if "mnew" has just been set, in which case we'd skip the
singledraw(), and somehow we've got back too soon before all the stuff
that happens after to fix it up, whatever that is.

Anyway, the summary is I've completely failed to understand even the
most basic points of the logic that sets up the completion list
consistently.

pws