improve fscript_set_global_object

This commit is contained in:
lixianjing 2022-11-17 11:35:43 +08:00
parent 30f5ee345d
commit eb3c109af7

View File

@ -3243,10 +3243,13 @@ tk_object_t* fscript_get_global_object(void) {
}
ret_t fscript_set_global_object(tk_object_t* obj) {
TK_OBJECT_UNREF(s_global_obj);
tk_object_t* old_global_obj = s_global_obj;
return_value_if_fail(obj != s_global_obj, RET_BAD_PARAMS);
TK_OBJECT_REF(obj);
s_global_obj = obj;
TK_OBJECT_UNREF(old_global_obj);
return RET_OK;
}