summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests/wrapllerrs.h
diff options
context:
space:
mode:
authorCallum Prentice <callum@lindenlab.com>2021-07-19 14:35:44 -0700
committerCallum Prentice <callum@lindenlab.com>2021-07-19 14:35:44 -0700
commit8631a7a07743af00431c6f33361ab06405bcf114 (patch)
treee7d983394f5ca0cbe2465780e8205cf32ba67ad3 /indra/llcommon/tests/wrapllerrs.h
parent57da3e609fddb37ef3ddef830a0be84ebc5337bd (diff)
parentbe6066eae218856f7fd74b98968a75e5062fa830 (diff)
Merge with tip of Master after a Viewer release
Diffstat (limited to 'indra/llcommon/tests/wrapllerrs.h')
-rw-r--r--indra/llcommon/tests/wrapllerrs.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h
index b07d5afbd8..3779fb41bc 100644
--- a/indra/llcommon/tests/wrapllerrs.h
+++ b/indra/llcommon/tests/wrapllerrs.h
@@ -44,10 +44,6 @@
#include <list>
#include <string>
-// statically reference the function in test.cpp... it's short, we could
-// replicate, but better to reuse
-extern void wouldHaveCrashed(const std::string& message);
-
struct WrapLLErrs
{
WrapLLErrs():
@@ -59,7 +55,8 @@ struct WrapLLErrs
mPriorFatal(LLError::getFatalFunction())
{
// Make LL_ERRS call our own operator() method
- LLError::setFatalFunction(boost::bind(&WrapLLErrs::operator(), this, _1));
+ LLError::setFatalFunction(
+ [this](const std::string& message){ (*this)(message); });
}
~WrapLLErrs()
@@ -199,11 +196,13 @@ public:
// with that output. If it turns out that saveAndResetSettings() has
// some bad effect, give up and just let the DEBUG level log messages
// display.
- : boost::noncopyable(),
+ : boost::noncopyable(),
+ mFatalFunction(LLError::getFatalFunction()),
mOldSettings(LLError::saveAndResetSettings()),
- mRecorder(new CaptureLogRecorder())
+ mRecorder(new CaptureLogRecorder())
{
- LLError::setFatalFunction(wouldHaveCrashed);
+ // reinstate the FatalFunction we just reset
+ LLError::setFatalFunction(mFatalFunction);
LLError::setDefaultLevel(level);
LLError::addRecorder(mRecorder);
}
@@ -219,17 +218,18 @@ public:
/// for the sought string.
std::string messageWith(const std::string& search, bool required=true)
{
- return boost::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->messageWith(search, required);
+ return boost::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->messageWith(search, required);
}
std::ostream& streamto(std::ostream& out) const
{
- return boost::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->streamto(out);
+ return boost::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->streamto(out);
}
private:
+ LLError::FatalFunction mFatalFunction;
LLError::SettingsStoragePtr mOldSettings;
- LLError::RecorderPtr mRecorder;
+ LLError::RecorderPtr mRecorder;
};
#endif /* ! defined(LL_WRAPLLERRS_H) */