summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcommon/lleventcoro.cpp13
-rw-r--r--indra/llmessage/tests/llcoproceduremanager_test.cpp2
2 files changed, 9 insertions, 6 deletions
diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp
index 367ddf485d..aa9f4b7840 100644
--- a/indra/llcommon/lleventcoro.cpp
+++ b/indra/llcommon/lleventcoro.cpp
@@ -134,12 +134,15 @@ LLBoundListener postAndSuspendSetup(const std::string& callerName,
// return the consuming attribute for some other coroutine, most likely
// the main routine.
bool consuming(LLCoros::get_consuming());
+
+ std::shared_ptr<LLBoundListener> connection_ptr = std::make_shared<LLBoundListener>();
+
// make a callback that will assign a value to the future, and listen on
// the specified LLEventPump with that callback
- LLBoundListener connection(
- replyPump.getPump().listen(listenerName,
- [&promise, consuming, listenerName](const LLSD& result)
+ *connection_ptr = replyPump.getPump().listen(listenerName,
+ [&promise, consuming, listenerName, connection_ptr](const LLSD& result)
{
+ connection_ptr->disconnect();
try
{
promise.set_value(result);
@@ -150,7 +153,7 @@ LLBoundListener postAndSuspendSetup(const std::string& callerName,
<< listenerName << "' " << ex.what() << LL_ENDL;
}
return consuming;
- }));
+ });
// skip the "post" part if requestPump is default-constructed
if (requestPump)
{
@@ -169,7 +172,7 @@ LLBoundListener postAndSuspendSetup(const std::string& callerName,
LL_DEBUGS("lleventcoro") << callerName << ": coroutine " << listenerName
<< " about to wait on LLEventPump " << replyPump.getPump().getName()
<< LL_ENDL;
- return connection;
+ return *connection_ptr;
}
} // anonymous
diff --git a/indra/llmessage/tests/llcoproceduremanager_test.cpp b/indra/llmessage/tests/llcoproceduremanager_test.cpp
index 8c4937fd84..8ba9a84356 100644
--- a/indra/llmessage/tests/llcoproceduremanager_test.cpp
+++ b/indra/llmessage/tests/llcoproceduremanager_test.cpp
@@ -4,7 +4,7 @@
* @date 2019-02
* @brief LLCoprocedureManager unit test
*
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*