diff --git a/indra/aistatemachine/aistatemachine.h b/indra/aistatemachine/aistatemachine.h index 66d85f003..a9ac33d68 100644 --- a/indra/aistatemachine/aistatemachine.h +++ b/indra/aistatemachine/aistatemachine.h @@ -308,6 +308,7 @@ class AIStateMachine : public LLThreadSafeRefCount virtual void abort_impl(void) { } virtual void finish_impl(void) { } virtual char const* state_str_impl(state_type run_state) const = 0; + virtual void force_killed(void); // Called from AIEngine::flush(). private: void reset(void); // Called from run() to (re)initialize a (re)start. @@ -324,7 +325,6 @@ class AIStateMachine : public LLThreadSafeRefCount mSleep = 0; return mSleep != 0; } - void force_killed(void); // Called from AIEngine::flush(). friend class AIEngine; // Calls multiplex() and force_killed(). }; diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index b10b0c370..5b806161b 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -146,6 +146,18 @@ void LLURLRequest::initialize_impl(void) } } +void LLURLRequest::force_killed(void) +{ + // Avoid destructing the responder, if any, because that might + // execute code that might crash now that the viewer is exiting. + if (mResponder) + { + intrusive_ptr_add_ref(mResponder.get()); + } + // Call base class. + AIStateMachine::force_killed(); +} + void LLURLRequest::addHeader(const char* header) { AICurlEasyRequest_wat curlEasyRequest_w(*mCurlEasyRequest); diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h index de92156c6..c888b7db3 100644 --- a/indra/llmessage/llurlrequest.h +++ b/indra/llmessage/llurlrequest.h @@ -118,6 +118,9 @@ class LLURLRequest : public AICurlEasyRequestStateMachine { protected: // Handle initializing the object. /*virtual*/ void initialize_impl(void); + + // Called when statemachine was flushed (and killed) at viewer exit. + /*virtual*/ void force_killed(void); }; #endif // LL_LLURLREQUEST_H