On Wed, Sep 2, 2015 at 3:16 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> This patch appears, so far, to run without a segfault

No segfault overnight.
 
Can you please verify that when the (unmodified) code does segfault,
the offending face ID is indeed stored in
last_escape_glyph_merged_face_id?  I'd like to be sure we have really
found the source of that face ID.

It is, indeed, and last_escape_glyph_frame also equals it->f.

Revised patch attached.