Do not destruct running Responders upon viewer exit.

This hopefully saves some crashes.
This commit is contained in:
Aleric Inglewood
2013-12-29 21:50:10 +01:00
parent 4416dafe73
commit e523aadc4a
3 changed files with 16 additions and 1 deletions

View File

@@ -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().
};

View File

@@ -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);

View File

@@ -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