Subject: bug#20890: master 1233bcb: Work around GC+Cairo bug

From: Robert Pluim <[email-masked]>
Date: Wed, 04 Apr 2018 14:10:12 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Robert Pluim <[email-masked]>
>> Cc: [email-masked],  [email-masked]
>> Date: Wed, 04 Apr 2018 10:52:42 +0200
>> 
>> > Sorry, I don't understand: are you saying that you still get crashes
>> > inside ftfont_close, after the above commit?  If so, can you please
>> > show the backtrace?
>> 
>> Yes.
>> 
>> > (Let's please continue discussing this in the bug report, not here.)
>> 
>> Moved there. Backtrace:
>> 
>> Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
>> 0x00007ffff1f87c68 in FT_List_Find () from /usr/lib/x86_64-linux-gnu/libfreetype.so.6
>> (gdb) bt
>> #0  0x00007ffff1f87c68 in FT_List_Find () from /usr/lib/x86_64-linux-gnu/libfreetype.so.6
>> #1  0x00007ffff1f87ecf in FT_Done_Size () from /usr/lib/x86_64-linux-gnu/libfreetype.so.6
>> #2  0x00000000005d5484 in ftcrfont_close (font=0x35fdf60) at ftcrfont.c:176
>> #3  0x00000000005502db in cleanup_vector (vector=vector@entry=0x35fdf60) at alloc.c:3194
>
> This is not in ftfont_close, this is in ftcrfont_close.

Ah yes. Too many functions with similar names, plus this happens only
when running Ubuntu, not Fedora.

> If you can tell why FT_List_Find crashes, in terms of Emacs variables
> and data structures, maybe we can figure out what is going on here.
> But in any case, I think we should put the same workaround in
> ftcrfont_close as we did in ftfont_close, because the former calls the
> latter, and we then risk the situation where we only half-close the
> font when ftcrfont_close is called from GC.

That same workaround fixes it on Ubuntu.

Robert