You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Windows: fix multi-thread unsafe and update test
On Windows, the handle of entire window device context is saved to
`srcdc`. But the device context will be released once the thread who
creates it has died, so that `srcdc` is no loner valid. Replace `srcdc`
with `srcdc_dict` to maintain srcdc values created by multiple threads
which ensure the validity of srcdc when it's used.
A threading lock is add to prevent multiple threads from grabbing and
modifying shared class attributes `bmp`/`srcdc`/`memdc` (their windows
object in fact) at same time. Otherwise, unexpected screenshot or
unpredictable error will occur.
Add test_thread_safety in test_windows.py
0 commit comments