diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloaterluascripts.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llluamanager.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llluamanager.h | 3 |
3 files changed, 4 insertions, 15 deletions
diff --git a/indra/newview/llfloaterluascripts.cpp b/indra/newview/llfloaterluascripts.cpp index 30353a7210..39d5816b0d 100644 --- a/indra/newview/llfloaterluascripts.cpp +++ b/indra/newview/llfloaterluascripts.cpp @@ -54,8 +54,7 @@ LLFloaterLUAScripts::LLFloaterLUAScripts(const LLSD &key) if (mScriptList->hasSelectedItem()) { std::string coro_name = mScriptList->getSelectedValue(); - LLEventPumps::instance().obtain("LLLua").post(llsd::map("status", "close", "coro", coro_name)); - LLLUAmanager::terminateScript(coro_name); + LLCoros::instance().killreq(coro_name); } }); } diff --git a/indra/newview/llluamanager.cpp b/indra/newview/llluamanager.cpp index dfa27ebc37..e2950648a6 100644 --- a/indra/newview/llluamanager.cpp +++ b/indra/newview/llluamanager.cpp @@ -49,7 +49,6 @@ #include <vector> std::map<std::string, std::string> LLLUAmanager::sScriptNames; -std::set<std::string> LLLUAmanager::sTerminationList; const S32 INTERRUPTS_MAX_LIMIT = 20000; const S32 INTERRUPTS_SUSPEND_LIMIT = 100; @@ -196,7 +195,7 @@ void check_interrupts_counter(lua_State* L) S32 counter = lua_tointeger(L, -1); lua_pop(L, 1); - counter++; + set_interrupts_counter(L, ++counter); if (counter > INTERRUPTS_MAX_LIMIT) { lluau::error(L, "Possible infinite loop, terminated."); @@ -205,7 +204,6 @@ void check_interrupts_counter(lua_State* L) { llcoro::suspend(); } - set_interrupts_counter(L, counter); } void LLLUAmanager::runScriptFile(const std::string &filename, script_result_fn result_cb, script_finished_fn finished_cb) @@ -229,13 +227,8 @@ void LLLUAmanager::runScriptFile(const std::string &filename, script_result_fn r // skip if we're interrupting only for garbage collection if (gc >= 0) return; - - auto it = sTerminationList.find(LLCoros::getName()); - if (it != sTerminationList.end()) - { - sTerminationList.erase(it); - lluau::error(L, "Script was terminated"); - } + + LLCoros::checkStop(); check_interrupts_counter(L); }; std::string text{std::istreambuf_iterator<char>(in_file), {}}; diff --git a/indra/newview/llluamanager.h b/indra/newview/llluamanager.h index d671719bc4..af9dcf70c2 100644 --- a/indra/newview/llluamanager.h +++ b/indra/newview/llluamanager.h @@ -85,12 +85,9 @@ public: static void runScriptOnLogin(); static const std::map<std::string, std::string> getScriptNames() { return sScriptNames; } - static std::set<std::string> getTerminationList() { return sTerminationList; } - static void terminateScript(std::string& coro_name) { sTerminationList.insert(coro_name); } private: static std::map<std::string, std::string> sScriptNames; - static std::set<std::string> sTerminationList; }; class LLRequireResolver |