Prevent a segfault when deleting a fullscreen frame on NextStep.

* nsterm.m ([EmacsView resetCursorRects:]): Be defensive when
accessing FRAME_OUTPUT_DATA.  [resetCursorRects:] can be called
from the event loop after the frame is deleted.  When this
happens, emacsframe is NULL.  This means there is an underlying
leak of the EmacsView object!  (Bug#59794)
Do not merge to master.

Copyright-paperwork-exempt: yes
This commit is contained in:
Kai Ma 2022-12-03 18:17:26 +08:00 committed by Eli Zaretskii
parent 3768b10077
commit 029988d4a5

View file

@ -6703,8 +6703,16 @@ - (BOOL)acceptsFirstResponder
- (void)resetCursorRects
{
NSRect visible = [self visibleRect];
NSCursor *currentCursor = FRAME_POINTER_TYPE (emacsframe);
NSRect visible;
NSCursor *currentCursor;
/* On macOS 13, [resetCursorRects:] could be called even after the
window is closed. */
if (! emacsframe || ! FRAME_OUTPUT_DATA (emacsframe))
return;
visible = [self visibleRect];
currentCursor = FRAME_POINTER_TYPE (emacsframe);
NSTRACE ("[EmacsView resetCursorRects]");
if (currentCursor == nil)