Subject: Re: bug#20802: Segfault when showing non-GTK+ tooltip

From: martin rudalics <[email-masked]>
Date: Mon, 15 Jun 2015 18:00:55 +0200

>> How are these supposed to
 >> work when GLYPH_DEBUG is not defined?
 >
 > It cannot, obviously.  Bug#17524 was reported in the GLYPH_DEBUG code:
 > the assertion there segfaulted when it tried to access the image
 > cache.  So the code was fixed only for that situation.

Hmmm ...  you should have told Michael back then.  You clairvoyantly
identified the problem then as ...

   But the real problem is that call to
   x_free_frame_resources, which eventually calls free_frame_faces, which
   decrements the image-cache refcount and frees the image cache, because
   the refcount goes to zero.

... but the recipe ...

   So I think the X version needs the same change I made in w32fns.c in
   revision 117131, modulo the changes to the assertions.

... was misleading because the bug was triggerd without violating an
assertion.  I doubt that Michael then build with glyph debugging enabled
because otherwise his fix should have helped indeed.

 > IOW, that bug was mentioned as a source of ideas, not as something to
 > copy verbatim to xfns.c.  Sorry if I was unclear about that.

OK.  One last question: In struct image_cache we specify refcount as
ptrdiff_t while w32fns.c defines image_cache_refcount as int.  Both
xfns.c and nsfns.m define image_cache_refcount as ptrdiff_t.  Shouldn't
we uniquify this?

martin