summaryrefslogtreecommitdiff
path: root/indra/llcommon/llcoros.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2019-11-22 11:58:27 -0500
committerNat Goodspeed <nat@lindenlab.com>2020-03-25 19:24:25 -0400
commit2a56ab44360aa49bd0df9281efc8a8a97a510013 (patch)
tree4653d4a08e7043a9b90eb26ce7370cf6f7a6a300 /indra/llcommon/llcoros.cpp
parent95cf6dddae371c8f53a2495a12e188bb2ca02799 (diff)
DRTVWR-476, SL-12197: Don't throw Stopping from main coroutine.
The new LLCoros::Stop exception is intended to terminate long-lived coroutines -- not interrupt mainstream shutdown processing. Only throw it on an explicitly-launched coroutine. Make LLCoros::getName() (used by the above test) static. As with other LLCoros methods, it might be called after the LLCoros LLSingleton instance has been deleted. Requiring the caller to call instance() implies a possible need to also call wasDeleted(). Encapsulate that nuance into a static method instead.
Diffstat (limited to 'indra/llcommon/llcoros.cpp')
-rw-r--r--indra/llcommon/llcoros.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp
index febe74b559..5f940de52b 100644
--- a/indra/llcommon/llcoros.cpp
+++ b/indra/llcommon/llcoros.cpp
@@ -192,7 +192,8 @@ bool LLCoros::kill(const std::string& name)
}
|*==========================================================================*/
-std::string LLCoros::getName() const
+//static
+std::string LLCoros::getName()
{
return get_CoroData("getName()").mName;
}
@@ -320,12 +321,21 @@ void LLCoros::toplevel(std::string name, callable_t callable)
}
}
+//static
void LLCoros::checkStop()
{
if (wasDeleted())
{
LLTHROW(Shutdown("LLCoros was deleted"));
}
+ // do this AFTER the check above, because getName() depends on
+ // get_CoroData(), which depends on the local_ptr in our instance().
+ if (getName().empty())
+ {
+ // Our Stop exception and its subclasses are intended to stop loitering
+ // coroutines. Don't throw it from the main coroutine.
+ return;
+ }
if (LLApp::isStopped())
{
LLTHROW(Stopped("viewer is stopped"));