* 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
- (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)