mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-03 08:30:09 +00:00
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)
This commit is contained in:
parent
38ae6cf3ce
commit
5f1bd87247
@ -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 */
|
||||
|
30
src/nsterm.m
30
src/nsterm.m
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user