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)
(cherry picked from commit 5f1bd87247
)
This commit is contained in:
parent
cb911febc6
commit
f02944f5a1
3 changed files with 39 additions and 0 deletions
|
@ -6145,6 +6145,11 @@ garbage_collect (void)
|
||||||
mark_fringe_data ();
|
mark_fringe_data ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_NS
|
||||||
|
mark_nsterm ();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Everything is now marked, except for the data in font caches,
|
/* Everything is now marked, except for the data in font caches,
|
||||||
undo lists, and finalizers. The first two are compacted by
|
undo lists, and finalizers. The first two are compacted by
|
||||||
removing an items which aren't reachable otherwise. */
|
removing an items which aren't reachable otherwise. */
|
||||||
|
|
|
@ -683,6 +683,7 @@ typedef id instancetype;
|
||||||
int em_whole;
|
int em_whole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) mark;
|
||||||
- (instancetype) initFrame: (NSRect )r window: (Lisp_Object)win;
|
- (instancetype) initFrame: (NSRect )r window: (Lisp_Object)win;
|
||||||
- (void)setFrame: (NSRect)r;
|
- (void)setFrame: (NSRect)r;
|
||||||
|
|
||||||
|
@ -1347,4 +1348,7 @@ enum NSWindowTabbingMode
|
||||||
#define NSControlStateValueOff NSOffState
|
#define NSControlStateValueOff NSOffState
|
||||||
#define NSBezelStyleRounded NSRoundedBezelStyle
|
#define NSBezelStyleRounded NSRoundedBezelStyle
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern void mark_nsterm (void);
|
||||||
|
|
||||||
#endif /* HAVE_NS */
|
#endif /* HAVE_NS */
|
||||||
|
|
30
src/nsterm.m
30
src/nsterm.m
|
@ -9039,6 +9039,16 @@ -(bool)judge
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) mark
|
||||||
|
{
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
|
Lisp_Object win;
|
||||||
|
XSETWINDOW (win, window);
|
||||||
|
mark_object (win);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)resetCursorRects
|
- (void)resetCursorRects
|
||||||
{
|
{
|
||||||
|
@ -9780,6 +9790,26 @@ Convert an X font name (XLFD) to an NS font name.
|
||||||
return ret;
|
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
|
void
|
||||||
syms_of_nsterm (void)
|
syms_of_nsterm (void)
|
||||||
|
|
Loading…
Add table
Reference in a new issue