浏览代码

Add main thread check.

aster2013 11 年之前
父节点
当前提交
8cba7977dc
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      Source/Engine/LuaScript/ToluaUtils.cpp

+ 4 - 1
Source/Engine/LuaScript/ToluaUtils.cpp

@@ -51,7 +51,10 @@ Context* GetContext(lua_State* L)
 {
     HashMap<void*, Context*>::ConstIterator i = contextMapping.Find(L);
     if (i == contextMapping.End())
-        return GetContext(lua_getmainthread(L));
+    {
+        lua_State* L1 = lua_getmainthread(L);
+        return (L == L1) ? 0 : GetContext(L1);
+    }
 
     return i->second_;
 }