From f072b47dc13cbc5616f73c23b52845abaf1c2fbd Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Thu, 14 Apr 2011 14:28:24 +0000 Subject: [PATCH] Warn earlier about some non-thread-safe calls. This was SVN commit r9252. --- source/scriptinterface/ScriptInterface.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/scriptinterface/ScriptInterface.cpp b/source/scriptinterface/ScriptInterface.cpp index babca761df..53621fe7b3 100644 --- a/source/scriptinterface/ScriptInterface.cpp +++ b/source/scriptinterface/ScriptInterface.cpp @@ -792,6 +792,8 @@ bool ScriptInterface::LoadScript(const VfsPath& filename, const std::wstring& co bool ScriptInterface::LoadGlobalScriptFile(const VfsPath& path) { + debug_assert(ThreadUtil::IsMainThread()); // VFS isn't thread-safe + if (!VfsFileExists(g_VFS, path)) { 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) { + debug_assert(ThreadUtil::IsMainThread()); // VFS isn't thread-safe + if (!VfsFileExists(g_VFS, path)) { LOGERROR(L"File '%ls' does not exist", path.string().c_str());