Commit 5f1bd872 authored by Gerd Moellmann's avatar Gerd Moellmann Committed by Eli Zaretskii
Browse files

Prevent GC of window referenced from EmacsScroller

* src/nsterm.m (EmacsScroller.mark, mark_nsterm): New functions.
* src/nsterm.h (EmacsScroller.mark, mark_nsterm): Declare.
* src/alloc.c (garbage_collect) [MAVE_NS]: Call mark_nsterm.
(Bug#56095)
parent 38ae6cf3
Pipeline #18728 passed with stages
in 34 minutes and 12 seconds
......@@ -6204,6 +6204,10 @@ garbage_collect (void)
mark_xterm ();
#endif
#ifdef HAVE_NS
mark_nsterm ();
#endif
/* Everything is now marked, except for the data in font caches,
undo lists, and finalizers. The first two are compacted by
removing an items which aren't reachable otherwise. */
......
......@@ -724,6 +724,7 @@ enum ns_return_frame_mode
int em_whole;
}
- (void) mark;
- (instancetype) initFrame: (NSRect )r window: (Lisp_Object)win;
- (void)setFrame: (NSRect)r;
......@@ -1373,4 +1374,7 @@ enum NSWindowTabbingMode
#define NSBezelStyleRounded NSRoundedBezelStyle
#define NSButtonTypeMomentaryPushIn NSMomentaryPushInButton
#endif
extern void mark_nsterm (void);
#endif /* HAVE_NS */
......@@ -9924,6 +9924,16 @@ -(bool)judge
return ret;
}
- (void) mark
{
if (window)
{
Lisp_Object win;
XSETWINDOW (win, window);
mark_object (win);
}
}
- (void)resetCursorRects
{
......@@ -10665,6 +10675,26 @@ Convert an X font name (XLFD) to an NS font name.
return ret;
}
void
mark_nsterm (void)
{
NSTRACE ("mark_nsterm");
Lisp_Object tail, frame;
FOR_EACH_FRAME (tail, frame)
{
struct frame *f = XFRAME (frame);
if (FRAME_NS_P (f))
{
NSArray *subviews = [[FRAME_NS_VIEW (f) superview] subviews];
for (int i = [subviews count] - 1; i >= 0; --i)
{
id scroller = [subviews objectAtIndex: i];
if ([scroller isKindOfClass: [EmacsScroller class]])
[scroller mark];
}
}
}
}
void
syms_of_nsterm (void)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment