Make Magnifier more Robust to error/freeze (#19732)
Fixes #19711
Summary of the issue:
The magnifier could freeze after a _ctypes.COMError (RPC_E_DISCONNECTED) raised by the UIA API (Notepad RichEditD2DPT).
The exception was not caught in focusManager.py, causing the magnifier timer loop to stop permanently while the user continued navigating normally.
Description of user facing changes:
Magnifier no longer freezes on COM/UIA disconnection.
Timer loop is protected and always reschedules.
After 3 consecutive errors, automatic recovery is attempted.
Fullscreen magnifier reinitializes the Magnification API if needed.
Clean stop with feedback if recovery fails.
Description of developer facing changes:
focusManager.py
Broadened except (...) → except Exception
Added debug logging.
magnifier.py
Wrapped _updateMagnifier() in try/except Exception
Added _consecutiveErrors counter.
Added _attemptRecovery() base method.
fullscreenMagnifier.py
Broadened exception handling.
Protected mouse move calls.
Added recovery via MagUninitialize() → MagInitialize().
spotlightManager.py
Wrapped magnification calls in _executeStep() to prevent animation breakage.
Description of development approach:
Prevent unhandled COM exceptions.
Protect the timer loop from breaking.
Add controlled recovery after repeated failures.
Ensure clean failure instead of silent freeze.