Skip to content
Prev Previous commit
Next Next commit
Rename apcsWillBeStronglyReferenced
  • Loading branch information
LeonarddeR committed Jun 1, 2023
commit 10ade40dfe4f838895cf4d7477985cf94d2b0688
6 changes: 3 additions & 3 deletions source/hwIo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from logHandler import log
import config
import time
from .ioThread import IoThread, apcsWillBeStronglyReferenced
from .ioThread import IoThread, _apcsWillBeStronglyReferenced
import NVDAState


Expand Down Expand Up @@ -95,7 +95,7 @@ def _initialRead(self):
ioThread = self._ioThreadRef()
if not ioThread:
raise RuntimeError("I/O thread is no longer available")
if apcsWillBeStronglyReferenced:
if _apcsWillBeStronglyReferenced:
ioThread.queueAsApc(self._asyncReadBackwardsCompat)
else:
ioThread.queueAsApc(self._asyncRead)
Expand Down Expand Up @@ -178,7 +178,7 @@ def _asyncRead(self, param: Optional[int] = None):
ioThread.queueAsCompletionRoutine(self._ioDone, self._readOl)
)

if apcsWillBeStronglyReferenced:
if _apcsWillBeStronglyReferenced:
def _asyncReadBackwardsCompat(self, param: Optional[int] = None):
"""Backwards compatible wrapper around L{_asyncRead} that calls it without param.
"""
Expand Down
6 changes: 3 additions & 3 deletions source/hwIo/ioThread.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
OVERLAPPED
]
]
apcsWillBeStronglyReferenced = version_year < 2024 and NVDAState._allowDeprecatedAPI()
_apcsWillBeStronglyReferenced = version_year < 2024 and NVDAState._allowDeprecatedAPI()
"""
Starting from NVDA 2024.1, we will weakly reference functions that are executed as an APC.
This will ensure that objects from which APCs have been queuedwon't be scattering around
Expand Down Expand Up @@ -147,7 +147,7 @@ def start(self):
super().start()
self.handle = ctypes.windll.kernel32.OpenThread(winKernel.THREAD_SET_CONTEXT, False, self.ident)

if apcsWillBeStronglyReferenced:
if _apcsWillBeStronglyReferenced:
@contextmanager
def autoDeleteApcReference(self, apcUuid):
log.warning(
Expand Down Expand Up @@ -179,7 +179,7 @@ def _registerToCallAsApc(

# generate a number to identify the function in the store.
internalParam = next(self._apcParamCounter)
useWeak = _alwaysReferenceWeakly or not apcsWillBeStronglyReferenced
useWeak = _alwaysReferenceWeakly or not _apcsWillBeStronglyReferenced
reference = None
if useWeak:
# Generate a weak reference to the function
Expand Down