From e5bfce500f2631332544484210732e48f1f9fd53 Mon Sep 17 00:00:00 2001 From: Daneel Date: Thu, 26 Feb 2026 08:52:46 +0100 Subject: [PATCH] v13 patch: fix MRC retain/release for accessibilityElements array - arrayWithCapacity: returns autorelease object, must retain for ivar - Release old array before reassigning in rebuildAccessibilityTree - Release in EmacsView dealloc - Fixes crash: _NSPasteboardTypeCache countByEnumeratingWithState (dangling pointer) --- ...BoundsForRange-for-macOS-Zoom-cursor-.patch | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch b/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch index f614aa4..c1e37af 100644 --- a/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch +++ b/patches/0001-ns-implement-AXBoundsForRange-for-macOS-Zoom-cursor-.patch @@ -12,6 +12,7 @@ New classes: EmacsView becomes an AXGroup containing EmacsAccessibilityBuffer children. Notification hooks fire on cursor movement, text edits, and window changes. +Uses unsafe_unretained references (MRC compatible) and proper retain/release. --- --- a/src/nsterm.h 2026-02-26 08:46:18.118172281 +0100 +++ b/src/nsterm.h 2026-02-26 08:46:06.891980688 +0100 @@ -73,7 +74,7 @@ Notification hooks fire on cursor movement, text edits, and window changes. --- a/src/nsterm.m 2026-02-26 08:46:18.124172384 +0100 -+++ b/src/nsterm.m 2026-02-26 08:46:06.895980756 +0100 ++++ b/src/nsterm.m 2026-02-26 08:52:18.397374436 +0100 @@ -1104,6 +1104,11 @@ unblock_input (); @@ -697,7 +698,15 @@ Notification hooks fire on cursor movement, text edits, and window changes. EmacsView implementation ========================================================================== */ -@@ -9474,6 +10083,143 @@ +@@ -6889,6 +7498,7 @@ + [layer release]; + #endif + ++ [accessibilityElements release]; + [[self menu] release]; + [super dealloc]; + } +@@ -9474,6 +10084,144 @@ return fs_state; } @@ -753,7 +762,8 @@ Notification hooks fire on cursor movement, text edits, and window changes. + NSMutableArray *newElements = [NSMutableArray arrayWithCapacity:4]; + Lisp_Object root = FRAME_ROOT_WINDOW (emacsframe); + ns_ax_collect_windows (root, self, newElements); -+ accessibilityElements = newElements; ++ [accessibilityElements release]; ++ accessibilityElements = [newElements retain]; +} + +- (NSAccessibilityRole)accessibilityRole @@ -841,7 +851,7 @@ Notification hooks fire on cursor movement, text edits, and window changes. @end /* EmacsView */ -@@ -9941,6 +10687,14 @@ +@@ -9941,6 +10689,14 @@ return [super accessibilityAttributeValue:attribute]; }