Browse Source

deps/obs-scripting: Fix crash removing callbacks in script_unload

Signed-off-by: Ilya Chernikov <[email protected]>
(cherry picked from commit a609cfb2f0f368cc4ebb5d83da33f2cb333d4c0a)
Ilya Chernikov 2 years ago
parent
commit
c67f78b122
1 changed files with 3 additions and 0 deletions
  1. 3 0
      deps/obs-scripting/obs-scripting-lua.c

+ 3 - 0
deps/obs-scripting/obs-scripting-lua.c

@@ -1228,10 +1228,13 @@ void obs_lua_script_unload(obs_script_t *s)
 	/* call script_unload           */
 
 	pthread_mutex_lock(&data->mutex);
+	current_lua_script = data;
 
 	lua_getglobal(script, "script_unload");
 	lua_pcall(script, 0, 0, 0);
 
+	current_lua_script = NULL;
+
 	/* ---------------------------- */
 	/* remove all callbacks         */