Merge pull request #2001 from Xaymar/patch-fix-lua-stackable-filters

obs-scripting: Use a recursive mutex for Lua scripting
master
Jim 2019-08-08 23:54:18 -07:00 committed by GitHub
commit 4963cde35d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -641,7 +641,12 @@ static int obs_lua_register_source(lua_State *script)
if (!existing) {
ls.data = current_lua_script;
pthread_mutex_init(&ls.definition_mutex, NULL);
pthread_mutexattr_t mutexattr;
pthread_mutexattr_init(&mutexattr);
pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&ls.definition_mutex, &mutexattr);
pthread_mutexattr_destroy(&mutexattr);
info.type_data = bmemdup(&ls, sizeof(ls));
info.free_type_data = obs_lua_source_free_type_data;
info.get_name = obs_lua_source_get_name;