summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterluadebug.cpp24
-rw-r--r--indra/newview/llfloaterluadebug.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/indra/newview/llfloaterluadebug.cpp b/indra/newview/llfloaterluadebug.cpp
index 60571d6247..6da28aef5e 100644
--- a/indra/newview/llfloaterluadebug.cpp
+++ b/indra/newview/llfloaterluadebug.cpp
@@ -41,6 +41,7 @@
#include "llsdutil.h"
#include "lua_function.h"
#include "stringize.h"
+#include "tempset.h"
LLFloaterLUADebug::LLFloaterLUADebug(const LLSD &key)
@@ -77,6 +78,17 @@ LLFloaterLUADebug::~LLFloaterLUADebug()
void LLFloaterLUADebug::onExecuteClicked()
{
+ // Empirically, running Lua code that indirectly invokes the
+ // "LLNotifications" listener can result (via mysterious labyrinthine
+ // viewer UI byways) in a recursive call to this handler. We've seen Bad
+ // Things happen to the viewer with a second call to runScriptLine() with
+ // the same cmd on the same LuaState.
+ if (mExecuting)
+ {
+ LL_DEBUGS("Lua") << "recursive call to onExecuteClicked()" << LL_ENDL;
+ return;
+ }
+ TempSet executing(mExecuting, true);
mResultOutput->setValue("");
std::string cmd = mLineInput->getText();
@@ -94,6 +106,12 @@ void LLFloaterLUADebug::onBtnBrowse()
void LLFloaterLUADebug::onBtnRun()
{
+ if (mExecuting)
+ {
+ LL_DEBUGS("Lua") << "recursive call to onBtnRun()" << LL_ENDL;
+ return;
+ }
+ TempSet executing(mExecuting, true);
std::vector<std::string> filenames;
std::string filepath = mScriptPath->getText();
if (!filepath.empty())
@@ -105,6 +123,12 @@ void LLFloaterLUADebug::onBtnRun()
void LLFloaterLUADebug::runSelectedScript(const std::vector<std::string> &filenames)
{
+ if (mExecuting)
+ {
+ LL_DEBUGS("Lua") << "recursive call to runSelectedScript()" << LL_ENDL;
+ return;
+ }
+ TempSet executing(mExecuting, true);
mResultOutput->setValue("");
std::string filepath = filenames[0];
diff --git a/indra/newview/llfloaterluadebug.h b/indra/newview/llfloaterluadebug.h
index 7418174570..4d9e2fabca 100644
--- a/indra/newview/llfloaterluadebug.h
+++ b/indra/newview/llfloaterluadebug.h
@@ -66,6 +66,7 @@ private:
LLLineEditor* mLineInput;
LLLineEditor* mScriptPath;
LuaState mState;
+ bool mExecuting{ false };
};
#endif // LL_LLFLOATERLUADEBUG_H