nvda
dac72c17 - Fix freeze when locking / unlocking user session in Windows (#19065)

Commit
90 days ago
Fix freeze when locking / unlocking user session in Windows (#19065) Fixes #19037 Summary of the issue: After switching to 64 bit, when locking the user session with windows+l, or when cuming out of the lock screen, NVDA will freeze and become unusable. It was necessary to restart NVDA. This was caused by NVDA going into an infinit loop when trying to detect if a given window was above or below the lock screen. A loop would be calling winUser.GetWindow, and breaking when the window equals GWL_NOT_FOUND (0). However, after switching to 64 bit, the value from winUser.getWindow when there was no window, was now None, not 0, so it never matched and the loop continued for ever. winUser.getwindow internally calls user32's GetWindow, which with our new tightened winBindings ctypes definitions, was defined to return HWND, rather than just a default long. Problem is that ctypes always converts NULL pointers (including HWND) to None on return. Description of user facing changes: Description of developer facing changes: Description of development approach: for all functions in our high-level winUser module that return a window handle, ensure that 0 is returned instead of None if a null HWND is being returned. This keeps these high-level functions compatible with existing code, and therefore no longer breaks lock screen detection logic. Also add type hints for params and return for these particular functions.
Parents
Loading