summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-09-12 15:08:54 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-09-12 15:08:54 -0400
commit2b851fbd0b4f72f46ec68965b3e06451e20a5b39 (patch)
treed957de0172156b4e699a83035fc2344c8acbc299 /indra
parent6c6a42fbbc231bad6a7921c37cdcb82d17dc225f (diff)
Mediate "LLAppViewer" "userQuit" et al. via "mainloop" WorkQueue.
Empirically, this works better than engaging the respective LLAppViewer methods directly.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llappviewerlistener.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/indra/newview/llappviewerlistener.cpp b/indra/newview/llappviewerlistener.cpp
index d02b1b4a79..4690c91b61 100644
--- a/indra/newview/llappviewerlistener.cpp
+++ b/indra/newview/llappviewerlistener.cpp
@@ -35,6 +35,7 @@
// external library headers
// other Linden headers
#include "llappviewer.h"
+#include "workqueue.h"
LLAppViewerListener::LLAppViewerListener(const LLAppViewerGetter& getter):
LLEventAPI("LLAppViewer",
@@ -56,17 +57,23 @@ LLAppViewerListener::LLAppViewerListener(const LLAppViewerGetter& getter):
void LLAppViewerListener::userQuit(const LLSD& event)
{
LL_INFOS() << "Listener requested user quit" << LL_ENDL;
- mAppViewerGetter()->userQuit();
+ // Trying to engage this from (e.g.) a Lua-hosting C++ coroutine runs
+ // afoul of an assert in the logging machinery that LLMutex must be locked
+ // only from the main coroutine.
+ LL::WorkQueue::getInstance("mainloop")->post(
+ [appviewer=mAppViewerGetter()]{ appviewer->userQuit(); });
}
void LLAppViewerListener::requestQuit(const LLSD& event)
{
LL_INFOS() << "Listener requested quit" << LL_ENDL;
- mAppViewerGetter()->requestQuit();
+ LL::WorkQueue::getInstance("mainloop")->post(
+ [appviewer=mAppViewerGetter()]{ appviewer->requestQuit(); });
}
void LLAppViewerListener::forceQuit(const LLSD& event)
{
LL_INFOS() << "Listener requested force quit" << LL_ENDL;
- mAppViewerGetter()->forceQuit();
+ LL::WorkQueue::getInstance("mainloop")->post(
+ [appviewer=mAppViewerGetter()]{ appviewer->forceQuit(); });
}