diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2009-11-30 14:19:40 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2009-11-30 14:19:40 -0500 |
commit | 7681212d87ece6b05da8c3caa7a9168d3cd6222f (patch) | |
tree | 283e057c8ce956f0e1568de7ab66f1cf061deaa9 /indra/llcommon/llevents.cpp | |
parent | 6223485bfafb9343f4e352014dec7f53717bcb47 (diff) | |
parent | 7b6ddb4106726f1d4f39a98cc5d7b49e39abc907 (diff) |
Automated merge with ssh://hg.lindenlab.com/viewer/viewer-2-0/
Diffstat (limited to 'indra/llcommon/llevents.cpp')
-rw-r--r-- | indra/llcommon/llevents.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index 4bdfe5a867..31fdd9e60a 100644 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -459,11 +459,25 @@ void LLEventPump::stopListening(const std::string& name) bool LLEventStream::post(const LLSD& event) { if (! mEnabled) + { return false; + } + // NOTE NOTE NOTE: Any new access to member data beyond this point should + // cause us to move our LLStandardSignal object to a pimpl class along + // with said member data. Then the local shared_ptr will preserve both. + + // DEV-43463: capture a local copy of mSignal. We've turned up a + // cross-coroutine scenario (described in the Jira) in which this post() + // call could end up destroying 'this', the LLEventPump subclass instance + // containing mSignal, during the call through *mSignal. So -- capture a + // *stack* instance of the shared_ptr, ensuring that our heap + // LLStandardSignal object will live at least until post() returns, even + // if 'this' gets destroyed during the call. + boost::shared_ptr<LLStandardSignal> signal(mSignal); // Let caller know if any one listener handled the event. This is mostly // useful when using LLEventStream as a listener for an upstream // LLEventPump. - return (*mSignal)(event); + return (*signal)(event); } /***************************************************************************** @@ -492,9 +506,16 @@ void LLEventQueue::flush() // be processed in the *next* flush() call. EventQueue queue(mEventQueue); mEventQueue.clear(); + // NOTE NOTE NOTE: Any new access to member data beyond this point should + // cause us to move our LLStandardSignal object to a pimpl class along + // with said member data. Then the local shared_ptr will preserve both. + + // DEV-43463: capture a local copy of mSignal. See LLEventStream::post() + // for detailed comments. + boost::shared_ptr<LLStandardSignal> signal(mSignal); for ( ; ! queue.empty(); queue.pop_front()) { - (*mSignal)(queue.front()); + (*signal)(queue.front()); } } |