aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKai Ma2022-12-03 18:17:26 +0800
committerEli Zaretskii2022-12-04 14:50:04 +0200
commit029988d4a518b9b255a15e2aae3a2ad6565db47d (patch)
tree4b8987b8a55a3e9a1c231d9bad9a78d918e4fc02 /src
parent3768b1007775d58c3cadb1b3198209e71afefc52 (diff)
downloademacs-029988d4a518b9b255a15e2aae3a2ad6565db47d.tar.gz
emacs-029988d4a518b9b255a15e2aae3a2ad6565db47d.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/nsterm.m12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index 507f2a9e7da..c09f743ec7f 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6703,8 +6703,16 @@ ns_create_font_panel_buttons (id target, SEL select, SEL cancel_action)
6703 6703
6704- (void)resetCursorRects 6704- (void)resetCursorRects
6705{ 6705{
6706 NSRect visible = [self visibleRect]; 6706 NSRect visible;
6707 NSCursor *currentCursor = FRAME_POINTER_TYPE (emacsframe); 6707 NSCursor *currentCursor;
6708
6709 /* On macOS 13, [resetCursorRects:] could be called even after the
6710 window is closed. */
6711 if (! emacsframe || ! FRAME_OUTPUT_DATA (emacsframe))
6712 return;
6713
6714 visible = [self visibleRect];
6715 currentCursor = FRAME_POINTER_TYPE (emacsframe);
6708 NSTRACE ("[EmacsView resetCursorRects]"); 6716 NSTRACE ("[EmacsView resetCursorRects]");
6709 6717
6710 if (currentCursor == nil) 6718 if (currentCursor == nil)