Subject: bug#56095: 29.0.50; nsterm.m, use after free

From: Po Lu <[email-masked]>
Date: Mon, 20 Jun 2022 18:21:51 +0800

Gerd Möllmann <[email-masked]> writes:

> I'd say no: Ns_judge_scroll_bars is called for a frame, and loops over
> EmascScroller subviews of that frame. I don't see how it is could be
> certain that all EmascScrollers reference a live Emacs window at that
> point.

I see.  Still, the window should always be reachable through the struct
scroll_bar, which is scanned by GC and ought to be alive as long as the
EmacsScroller is.

But it seems there is no struct scroll_bar at all in the NS port!  (Why
does it always have to do things differently?)  Does anyone want me to
fix that?

In the meantime, a loop through all the scroll bars in a mark_nsterm
function would suffice.