fix(display): capture-mode check tolerates a DisplayManager built without __init__

main's new test_display_manager_logging builds one with object.__new__;
set_scrolling_state here asks whether the thread is capturing, which read
the per-thread state __init__ creates. Read it the way _current_surface()
already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chuck
2026-09-24 17:49:07 -04:00
co-authored by Claude Opus 5.5
parent 9c81e6b42f
commit 01b82edc23
+4 -1
View File
@@ -725,7 +725,10 @@ class DisplayManager:
@property @property
def _capture_mode_active(self) -> bool: def _capture_mode_active(self) -> bool:
"""True while the calling thread is capturing content off-screen.""" """True while the calling thread is capturing content off-screen."""
return getattr(self._capture_state, 'active', False) # Read like _current_surface(): a DisplayManager built without
# __init__ (tests do) has no per-thread state, and captures nothing.
state = self.__dict__.get('_capture_state')
return getattr(state, 'active', False) if state is not None else False
@_capture_mode_active.setter @_capture_mode_active.setter
def _capture_mode_active(self, value: bool) -> None: def _capture_mode_active(self, value: bool) -> None: