diff options
author | Loren Shih <seraph@lindenlab.com> | 2009-12-04 13:50:32 -0500 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2009-12-04 13:50:32 -0500 |
commit | c9c9943098d35914f7b8591bf66ea1ae3985a94e (patch) | |
tree | daa74a4288a0e5e5c028717e0b925633c11eac5b /indra/llcommon/llevents.cpp | |
parent | 92a1ecd5fdfff2490cb563e83baff88fc6120882 (diff) | |
parent | 5b695ac56a7fbbb4d1f63bccb0c147c46e56ebcf (diff) |
automated merge viewer2.0->avp
--HG--
branch : avatar-pipeline
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()); } } |