Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
[python] ensure we lock the GUI prior to calling ClearItems. Fixes #14780 #4370
@jimfcarroll please check - should be sane enough.
(What was happening is that ClearFileItems() locks the CFileItemList lock, then iterates through and free's each item, which eventually calls into the texturemanager to release textures. Ofcourse, the texturemanager attempts to grab the graphics lock (why not, right? It's not as if we abuse it too much anyway...) to protect it's objects rather than having more fine-grained locks. Meanwhile, the UI is rendering which holds graphics lock and needs to query the CFileItemList (thus attempts to grab that lock) -> deadlock.
Ideally the usage of g_graphicsContext as a mutex needs to be severely trimmed, but in the meantime, ensuring that python grabs it first will do the trick here.