mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
obs-scripting: Make callback "removed" variable atomic
Makes the callback variable "removed" atomic, and on script unload, first sets all callbacks to removed before actually unloading the script out of a safety precaution. (See note at the bottom for further details) This minimizes the possibility of a race condition where the script callback could be called while those callbacks were being removed. Big note for this change, this change should eventually be replaced with a reference counting ownership method where script callbacks can hold a reference and share ownership of the script if it's still alive while the script callback is being called. That way the script callbacks can safely execute. May require a fair amount of reworking of the script object.
This commit is contained in:
+1
@@ -195,6 +195,7 @@ static inline bool py_error_(const char *func, int line)
|
||||
#define py_error() py_error_(__FUNCTION__, __LINE__)
|
||||
|
||||
#define lock_python() PyGILState_STATE gstate = PyGILState_Ensure()
|
||||
#define relock_python() gstate = PyGILState_Ensure()
|
||||
#define unlock_python() PyGILState_Release(gstate)
|
||||
|
||||
struct py_source;
|
||||
|
||||
Reference in New Issue
Block a user