emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 029988d4a51: Prevent a segfault when deleting a fullscreen fram


From: Eli Zaretskii
Subject: emacs-29 029988d4a51: Prevent a segfault when deleting a fullscreen frame on NextStep.
Date: Sun, 4 Dec 2022 07:52:26 -0500 (EST)

branch: emacs-29
commit 029988d4a518b9b255a15e2aae3a2ad6565db47d
Author: Kai Ma <justksqsf@gmail.com>
Commit: Eli Zaretskii <eliz@gnu.org>

    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
---
 src/nsterm.m | 12 ++++++++++--
 1 file 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)
 
 - (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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]