patches: add 0009 resource safety hardening + update 0007/0008
New patch 0009 fixes HIGH severity issues from Opus review: - Announcement coalescing (50ms debounce) - cachedText retain+autorelease in accessibilityValue - EmacsView dealloc: nil out emacsView on all AX elements - Nil guards on protocol methods + overlayZoomActive 0007 updated: revert accidental em-dash→triple-dash, add overlayZoomActive nil guards 0008 updated: specpdl exception safety for accessibilityUpdating, lastChildFrameBuffer staticpro Series now 9 patches total (0001-0006 unchanged, 0007-0009 new/updated).
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
From 8564e4989f5f358092bd1494c3894a42974ee6e1 Mon Sep 17 00:00:00 2001
|
||||
From 7d20ec80aa0d4ca97fa789f9b85389e25d2ff719 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Sukany <martin@sukany.cz>
|
||||
Date: Sat, 28 Feb 2026 16:01:29 +0100
|
||||
Subject: [PATCH 2/2] ns: announce child frame completion candidates for
|
||||
Subject: [PATCH 2/3] ns: announce child frame completion candidates for
|
||||
VoiceOver
|
||||
|
||||
Completion frameworks such as Corfu, Company-box, and similar
|
||||
@@ -43,8 +43,8 @@ childFrameCompletionActive flag.
|
||||
refocus parent buffer element when child frame closes.
|
||||
---
|
||||
src/nsterm.h | 2 +
|
||||
src/nsterm.m | 279 ++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 278 insertions(+), 3 deletions(-)
|
||||
src/nsterm.m | 306 ++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 305 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/nsterm.h b/src/nsterm.h
|
||||
index 5c15639..8b34300 100644
|
||||
@@ -67,7 +67,7 @@ index 5c15639..8b34300 100644
|
||||
@end
|
||||
|
||||
diff --git a/src/nsterm.m b/src/nsterm.m
|
||||
index 143e784..da1a319 100644
|
||||
index c1fc3cb..abecb4c 100644
|
||||
--- a/src/nsterm.m
|
||||
+++ b/src/nsterm.m
|
||||
@@ -7066,6 +7066,110 @@ ns_ax_selected_overlay_text (struct buffer *b,
|
||||
@@ -181,7 +181,7 @@ index 143e784..da1a319 100644
|
||||
/* Build accessibility text for window W, skipping invisible text.
|
||||
Populates *OUT_START with the buffer start charpos.
|
||||
Populates *OUT_RUNS with an array of visible runs and *OUT_NRUNS
|
||||
@@ -12311,6 +12415,122 @@ ns_ax_collect_windows (Lisp_Object window, EmacsView *view,
|
||||
@@ -12313,6 +12417,146 @@ ns_ax_collect_windows (Lisp_Object window, EmacsView *view,
|
||||
The existing elements carry cached state (modiff, point) from the
|
||||
previous redisplay cycle. Rebuilding first would create fresh
|
||||
elements with current values, making change detection impossible. */
|
||||
@@ -289,6 +289,30 @@ index 143e784..da1a319 100644
|
||||
+static EMACS_INT lastChildFrameModiff;
|
||||
+static char *lastChildFrameCandidate;
|
||||
+
|
||||
+/* Child frame completion dedup state. File-scope so that
|
||||
+ lastChildFrameBuffer can be staticpro'd against GC. */
|
||||
+static Lisp_Object lastChildFrameBuffer;
|
||||
+static EMACS_INT lastChildFrameModiff;
|
||||
+static char *lastChildFrameCandidate;
|
||||
+
|
||||
+/* Reset the re-entrance guard when unwinding past
|
||||
+ postAccessibilityUpdates due to a Lisp signal (longjmp).
|
||||
+ Without this, a signal during Lisp calls (e.g. Fget_char_property
|
||||
+ in overlay or child frame scanning) would leave
|
||||
+ accessibilityUpdating = YES permanently, suppressing all future
|
||||
+ accessibility notifications. */
|
||||
+static void
|
||||
+ns_ax_reset_accessibility_updating (void *view)
|
||||
+{
|
||||
+ ((EmacsView *)view)->accessibilityUpdating = NO;
|
||||
+}
|
||||
+
|
||||
+/* Child frame completion dedup state. File-scope so that
|
||||
+ lastChildFrameBuffer can be staticpro'd against GC. */
|
||||
+static Lisp_Object lastChildFrameBuffer;
|
||||
+static EMACS_INT lastChildFrameModiff;
|
||||
+static char *lastChildFrameCandidate;
|
||||
+
|
||||
+/* Reset the re-entrance guard when unwinding past
|
||||
+ postAccessibilityUpdates due to a Lisp signal (longjmp).
|
||||
+ Without this, a signal during Lisp calls (e.g. Fget_char_property
|
||||
@@ -304,7 +328,7 @@ index 143e784..da1a319 100644
|
||||
- (void)postAccessibilityUpdates
|
||||
{
|
||||
NSTRACE ("[EmacsView postAccessibilityUpdates]");
|
||||
@@ -12321,10 +12541,60 @@ ns_ax_collect_windows (Lisp_Object window, EmacsView *view,
|
||||
@@ -12323,10 +12567,60 @@ ns_ax_collect_windows (Lisp_Object window, EmacsView *view,
|
||||
|
||||
/* Re-entrance guard: VoiceOver callbacks during notification posting
|
||||
can trigger redisplay, which calls ns_update_end, which calls us
|
||||
@@ -366,7 +390,7 @@ index 143e784..da1a319 100644
|
||||
|
||||
/* Detect window tree change (split, delete, new buffer). Compare
|
||||
FRAME_ROOT_WINDOW --- if it changed, the tree structure changed. */
|
||||
@@ -12355,7 +12625,7 @@ ns_ax_collect_windows (Lisp_Object window, EmacsView *view,
|
||||
@@ -12357,7 +12651,7 @@ ns_ax_collect_windows (Lisp_Object window, EmacsView *view,
|
||||
NSAccessibilityFocusedUIElementChangedNotification);
|
||||
|
||||
lastSelectedWindow = emacsframe->selected_window;
|
||||
@@ -375,7 +399,7 @@ index 143e784..da1a319 100644
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12399,7 +12669,7 @@ ns_ax_collect_windows (Lisp_Object window, EmacsView *view,
|
||||
@@ -12401,7 +12695,7 @@ ns_ax_collect_windows (Lisp_Object window, EmacsView *view,
|
||||
NSAccessibilityFocusedUIElementChangedNotification);
|
||||
}
|
||||
|
||||
@@ -384,12 +408,15 @@ index 143e784..da1a319 100644
|
||||
}
|
||||
|
||||
/* ---- Cursor position for Zoom (via accessibilityBoundsForRange:) ----
|
||||
@@ -14341,6 +14611,9 @@ syms_of_nsterm (void)
|
||||
@@ -14343,6 +14637,12 @@ syms_of_nsterm (void)
|
||||
DEFSYM (Qns_ax_completion, "completion");
|
||||
DEFSYM (Qns_ax_completions_highlight, "completions-highlight");
|
||||
DEFSYM (Qns_ax_backtab, "backtab");
|
||||
+
|
||||
+ lastChildFrameBuffer = Qnil;
|
||||
+ staticpro (&lastChildFrameBuffer);
|
||||
+
|
||||
+ lastChildFrameBuffer = Qnil;
|
||||
+ staticpro (&lastChildFrameBuffer);
|
||||
/* Qmouse_face and Qkeymap are defined in textprop.c / keymap.c. */
|
||||
Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
|
||||
|
||||
Reference in New Issue
Block a user