python3.9_2.patch 781 B

123456789101112131415161718192021222324
  1. diff --git a/source/blender/python/generic/bpy_threads.c b/source/blender/python/generic/bpy_threads.c
  2. index 5507aa73183..4807c1f5071 100644
  3. --- a/source/blender/python/generic/bpy_threads.c
  4. +++ b/source/blender/python/generic/bpy_threads.c
  5. @@ -29,14 +29,11 @@
  6. /* analogue of PyEval_SaveThread() */
  7. BPy_ThreadStatePtr BPY_thread_save(void)
  8. {
  9. - PyThreadState *tstate = PyThreadState_Swap(NULL);
  10. - /* note: tstate can be NULL when quitting Blender */
  11. -
  12. - if (tstate && PyEval_ThreadsInitialized()) {
  13. - PyEval_ReleaseLock();
  14. + /* The thread-state can be NULL when quitting Blender. */
  15. + if (_PyThreadState_UncheckedGet()) {
  16. + return (BPy_ThreadStatePtr)PyEval_SaveThread();
  17. }
  18. -
  19. - return (BPy_ThreadStatePtr)tstate;
  20. + return NULL;
  21. }
  22. /* analogue of PyEval_RestoreThread() */