Warn earlier about some non-thread-safe calls.

This was SVN commit r9252.
This commit is contained in:
Ykkrosh 2011-04-14 14:28:24 +00:00
parent 57e6980465
commit f072b47dc1

View File

@ -792,6 +792,8 @@ bool ScriptInterface::LoadScript(const VfsPath& filename, const std::wstring& co
bool ScriptInterface::LoadGlobalScriptFile(const VfsPath& path) bool ScriptInterface::LoadGlobalScriptFile(const VfsPath& path)
{ {
debug_assert(ThreadUtil::IsMainThread()); // VFS isn't thread-safe
if (!VfsFileExists(g_VFS, path)) if (!VfsFileExists(g_VFS, path))
{ {
LOGERROR(L"File '%ls' does not exist", path.string().c_str()); LOGERROR(L"File '%ls' does not exist", path.string().c_str());
@ -878,6 +880,8 @@ CScriptValRooted ScriptInterface::ParseJSON(const std::string& string_utf8)
CScriptValRooted ScriptInterface::ReadJSONFile(const VfsPath& path) CScriptValRooted ScriptInterface::ReadJSONFile(const VfsPath& path)
{ {
debug_assert(ThreadUtil::IsMainThread()); // VFS isn't thread-safe
if (!VfsFileExists(g_VFS, path)) if (!VfsFileExists(g_VFS, path))
{ {
LOGERROR(L"File '%ls' does not exist", path.string().c_str()); LOGERROR(L"File '%ls' does not exist", path.string().c_str());