summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llappearance/llwearable.cpp36
-rw-r--r--indra/llappearance/llwearable.h1
-rwxr-xr-xindra/llcharacter/llmotioncontroller.cpp7
-rwxr-xr-xindra/llcharacter/llvisualparam.cpp13
-rwxr-xr-xindra/llcharacter/llvisualparam.h1
-rwxr-xr-xindra/llcommon/llerror.cpp444
-rwxr-xr-xindra/llcommon/llerror.h4
-rwxr-xr-xindra/llcommon/llerrorcontrol.h23
-rwxr-xr-xindra/llcommon/tests/llerror_test.cpp78
-rwxr-xr-xindra/llcommon/tests/wrapllerrs.h117
-rwxr-xr-xindra/llmessage/llares.cpp9
-rwxr-xr-xindra/llmessage/llares.h1
-rwxr-xr-xindra/llmessage/llcurl.cpp45
-rwxr-xr-xindra/llmessage/llcurl.h3
-rwxr-xr-xindra/llmessage/llhttpclient.cpp2
-rwxr-xr-xindra/llrender/llimagegl.cpp65
-rwxr-xr-xindra/llrender/llimagegl.h3
-rwxr-xr-xindra/llui/llbadgeowner.cpp2
-rwxr-xr-xindra/llui/llfolderview.cpp3
-rwxr-xr-xindra/llui/lllineeditor.cpp1
-rwxr-xr-xindra/llui/llmenubutton.cpp1
-rwxr-xr-xindra/llui/llscrolllistctrl.cpp1
-rwxr-xr-xindra/llui/lltabcontainer.cpp21
-rwxr-xr-xindra/llui/lltextbase.cpp1
-rwxr-xr-xindra/llui/lltexteditor.cpp1
-rwxr-xr-xindra/llui/lltoolbar.cpp1
-rwxr-xr-xindra/llwindow/llwindowwin32.cpp2
-rwxr-xr-xindra/newview/llappviewer.cpp5
-rw-r--r--indra/newview/llappviewerwin32.cpp21
-rw-r--r--indra/newview/llappviewerwin32.h3
-rwxr-xr-xindra/newview/llchathistory.cpp47
-rwxr-xr-xindra/newview/llchathistory.h7
-rwxr-xr-xindra/newview/llchiclet.cpp1
-rwxr-xr-xindra/newview/lllistcontextmenu.cpp1
-rwxr-xr-xindra/newview/llmediactrl.cpp11
-rwxr-xr-xindra/newview/llmediactrl.h2
-rwxr-xr-xindra/newview/llpaneloutfitedit.cpp2
-rwxr-xr-xindra/newview/llpanelteleporthistory.cpp2
-rwxr-xr-xindra/newview/llscreenchannel.cpp8
-rwxr-xr-xindra/newview/llspatialpartition.h16
-rwxr-xr-xindra/newview/llviewermedia.cpp5
-rwxr-xr-xindra/newview/llviewershadermgr.cpp10
-rwxr-xr-xindra/newview/llviewershadermgr.h1
-rwxr-xr-xindra/newview/llviewerwindow.cpp33
-rwxr-xr-xindra/newview/llvovolume.cpp118
-rwxr-xr-xindra/newview/llwindebug.cpp20
-rwxr-xr-xindra/newview/llwindebug.h1
-rwxr-xr-xindra/test/test.cpp62
48 files changed, 798 insertions, 464 deletions
diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
index 389505fa34..d064b2982c 100644
--- a/indra/llappearance/llwearable.cpp
+++ b/indra/llappearance/llwearable.cpp
@@ -43,9 +43,32 @@ S32 LLWearable::sCurrentDefinitionVersion = 1;
// Private local functions
static std::string terse_F32_to_string(F32 f);
+LLWearable::LLWearable()
+ : mDefinitionVersion(-1),
+ mName(),
+ mDescription(),
+ mPermissions(),
+ mSaleInfo(),
+ mType(LLWearableType::WT_NONE),
+ mSavedVisualParamMap(),
+ mVisualParamIndexMap(),
+ mTEMap(),
+ mSavedTEMap()
+{
+}
+
// virtual
LLWearable::~LLWearable()
{
+ for (visual_param_index_map_t::iterator vpIter = mVisualParamIndexMap.begin(); vpIter != mVisualParamIndexMap.end(); ++vpIter)
+ {
+ LLVisualParam* vp = vpIter->second;
+ vp->clearNextParam();
+ delete vp;
+ vpIter->second = NULL;
+ }
+
+ destroyTextures();
}
const std::string& LLWearable::getTypeLabel() const
@@ -620,17 +643,10 @@ void LLWearable::syncImages(te_map_t &src, te_map_t &dst)
void LLWearable::destroyTextures()
{
- for( te_map_t::iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter )
- {
- LLLocalTextureObject *lto = iter->second;
- delete lto;
- }
+ std::for_each(mTEMap.begin(), mTEMap.end(), DeletePairedPointer());
mTEMap.clear();
- for( te_map_t::iterator iter = mSavedTEMap.begin(); iter != mSavedTEMap.end(); ++iter )
- {
- LLLocalTextureObject *lto = iter->second;
- delete lto;
- }
+
+ std::for_each(mSavedTEMap.begin(), mSavedTEMap.end(), DeletePairedPointer());
mSavedTEMap.clear();
}
diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h
index 132c153bcd..96809aab58 100644
--- a/indra/llappearance/llwearable.h
+++ b/indra/llappearance/llwearable.h
@@ -46,6 +46,7 @@ class LLWearable
// Constructors and destructors
//--------------------------------------------------------------------
public:
+ LLWearable();
virtual ~LLWearable();
//--------------------------------------------------------------------
diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp
index 50ccfd75fb..e02b139608 100755
--- a/indra/llcharacter/llmotioncontroller.cpp
+++ b/indra/llcharacter/llmotioncontroller.cpp
@@ -172,6 +172,13 @@ void LLMotionController::deleteAllMotions()
for_each(mAllMotions.begin(), mAllMotions.end(), DeletePairedPointer());
mAllMotions.clear();
+
+ // stinson 05/12/20014 : Ownership of the LLMotion pointers is transferred from
+ // mAllMotions to mDeprecatedMotions in method
+ // LLMotionController::deprecateMotionInstance(). Thus, we should also clean
+ // up the mDeprecatedMotions list as well.
+ for_each(mDeprecatedMotions.begin(), mDeprecatedMotions.end(), DeletePointer());
+ mDeprecatedMotions.clear();
}
//-----------------------------------------------------------------------------
diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp
index 0df7fb2bc3..dd87847c18 100755
--- a/indra/llcharacter/llvisualparam.cpp
+++ b/indra/llcharacter/llvisualparam.cpp
@@ -178,7 +178,10 @@ LLVisualParam::LLVisualParam()
//-----------------------------------------------------------------------------
LLVisualParam::~LLVisualParam()
{
- delete mNext;
+ if (mNext != NULL)
+ {
+ delete mNext;
+ }
}
/*
@@ -285,6 +288,14 @@ void LLVisualParam::setNextParam( LLVisualParam *next )
}
//-----------------------------------------------------------------------------
+// clearNextParam()
+//-----------------------------------------------------------------------------
+void LLVisualParam::clearNextParam()
+{
+ mNext = NULL;
+}
+
+//-----------------------------------------------------------------------------
// animate()
//-----------------------------------------------------------------------------
void LLVisualParam::animate( F32 delta, BOOL upload_bake )
diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h
index a4d9f93e56..78c776705f 100755
--- a/indra/llcharacter/llvisualparam.h
+++ b/indra/llcharacter/llvisualparam.h
@@ -155,6 +155,7 @@ public:
LLVisualParam* getNextParam() { return mNext; }
void setNextParam( LLVisualParam *next );
+ void clearNextParam();
virtual void setAnimating(BOOL is_animating) { mIsAnimating = is_animating && !mIsDummy; }
BOOL getAnimating() const { return mIsAnimating; }
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index a7963174ad..22cd861c72 100755
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -47,6 +47,7 @@
#include "lllivefile.h"
#include "llsd.h"
#include "llsdserialize.h"
+#include "llsingleton.h"
#include "llstl.h"
#include "lltimer.h"
@@ -356,30 +357,31 @@ namespace
typedef std::map<std::string, LLError::ELevel> LevelMap;
- typedef std::vector<LLError::Recorder*> Recorders;
+ typedef std::vector<LLError::RecorderPtr> Recorders;
typedef std::vector<LLError::CallSite*> CallSiteVector;
- class Globals
+ class Globals : public LLSingleton<Globals>
{
public:
+ Globals();
+
std::ostringstream messageStream;
bool messageStreamInUse;
void addCallSite(LLError::CallSite&);
void invalidateCallSites();
-
- static Globals& get();
- // return the one instance of the globals
private:
CallSiteVector callSites;
-
- Globals()
- : messageStreamInUse(false)
- { }
-
};
+ Globals::Globals()
+ : messageStream(),
+ messageStreamInUse(false),
+ callSites()
+ {
+ }
+
void Globals::addCallSite(LLError::CallSite& site)
{
callSites.push_back(&site);
@@ -396,25 +398,17 @@ namespace
callSites.clear();
}
-
- Globals& Globals::get()
- {
- /* This pattern, of returning a reference to a static function
- variable, is to ensure that this global is constructed before
- it is used, no matter what the global initialization sequence
- is.
- See C++ FAQ Lite, sections 10.12 through 10.14
- */
- static Globals* globals = new Globals;
- return *globals;
- }
}
namespace LLError
{
- class Settings
+ class SettingsConfig : public LLRefCount
{
+ friend class Settings;
+
public:
+ virtual ~SettingsConfig();
+
bool mPrintLocation;
LLError::ELevel mDefaultLevel;
@@ -429,81 +423,86 @@ namespace LLError
LLError::TimeFunction mTimeFunction;
Recorders mRecorders;
- Recorder* mFileRecorder;
- Recorder* mFixedBufferRecorder;
+ RecorderPtr mFileRecorder;
+ RecorderPtr mFixedBufferRecorder;
std::string mFileRecorderFileName;
int mShouldLogCallCounter;
- static Settings& get();
+ private:
+ SettingsConfig();
+ };
+
+ typedef LLPointer<SettingsConfig> SettingsConfigPtr;
+
+ class Settings : public LLSingleton<Settings>
+ {
+ public:
+ Settings();
+
+ SettingsConfigPtr getSettingsConfig();
- static void reset();
- static Settings* saveAndReset();
- static void restore(Settings*);
+ void reset();
+ SettingsStoragePtr saveAndReset();
+ void restore(SettingsStoragePtr pSettingsStorage);
private:
- Settings()
- : mPrintLocation(false),
- mDefaultLevel(LLError::LEVEL_DEBUG),
- mCrashFunction(),
- mTimeFunction(NULL),
- mFileRecorder(NULL),
- mFixedBufferRecorder(NULL),
- mShouldLogCallCounter(0)
- { }
-
- ~Settings()
- {
- for_each(mRecorders.begin(), mRecorders.end(), DeletePointer());
- mRecorders.clear();
- }
-
- static Settings*& getPtr();
+ SettingsConfigPtr mSettingsConfig;
};
- Settings& Settings::get()
+ SettingsConfig::SettingsConfig()
+ : LLRefCount(),
+ mPrintLocation(false),
+ mDefaultLevel(LLError::LEVEL_DEBUG),
+ mFunctionLevelMap(),
+ mClassLevelMap(),
+ mFileLevelMap(),
+ mTagLevelMap(),
+ mUniqueLogMessages(),
+ mCrashFunction(NULL),
+ mTimeFunction(NULL),
+ mRecorders(),
+ mFileRecorder(),
+ mFixedBufferRecorder(),
+ mFileRecorderFileName(),
+ mShouldLogCallCounter(0)
{
- Settings* p = getPtr();
- if (!p)
- {
- reset();
- p = getPtr();
- }
- return *p;
}
-
- void Settings::reset()
+
+ SettingsConfig::~SettingsConfig()
{
- Globals::get().invalidateCallSites();
-
- Settings*& p = getPtr();
- delete p;
- p = new Settings();
+ mRecorders.clear();
+ }
+
+ Settings::Settings()
+ : LLSingleton<Settings>(),
+ mSettingsConfig(new SettingsConfig())
+ {
+ }
+
+ SettingsConfigPtr Settings::getSettingsConfig()
+ {
+ return mSettingsConfig;
}
- Settings* Settings::saveAndReset()
+ void Settings::reset()
{
- Globals::get().invalidateCallSites();
-
- Settings*& p = getPtr();
- Settings* originalSettings = p;
- p = new Settings();
- return originalSettings;
+ Globals::getInstance()->invalidateCallSites();
+ mSettingsConfig = new SettingsConfig();
}
- void Settings::restore(Settings* originalSettings)
+ SettingsStoragePtr Settings::saveAndReset()
{
- Globals::get().invalidateCallSites();
-
- Settings*& p = getPtr();
- delete p;
- p = originalSettings;
+ SettingsStoragePtr oldSettingsConfig(mSettingsConfig.get());
+ reset();
+ return oldSettingsConfig;
}
- Settings*& Settings::getPtr()
+ void Settings::restore(SettingsStoragePtr pSettingsStorage)
{
- static Settings* currentSettings = NULL;
- return currentSettings;
+ Globals::getInstance()->invalidateCallSites();
+ SettingsConfigPtr newSettingsConfig(dynamic_cast<SettingsConfig *>(pSettingsStorage.get()));
+ mSettingsConfig = newSettingsConfig;
}
}
@@ -604,7 +603,7 @@ namespace
void commonInit(const std::string& dir, bool log_to_stderr = true)
{
- LLError::Settings::reset();
+ LLError::Settings::getInstance()->reset();
LLError::setDefaultLevel(LLError::LEVEL_INFO);
LLError::setFatalFunction(LLError::crashAndLoop);
@@ -613,11 +612,13 @@ namespace
// log_to_stderr is only false in the unit and integration tests to keep builds quieter
if (log_to_stderr && shouldLogToStderr())
{
- LLError::addRecorder(new RecordToStderr(stderrLogWantsTime()));
+ LLError::RecorderPtr recordToStdErr(new RecordToStderr(stderrLogWantsTime()));
+ LLError::addRecorder(recordToStdErr);
}
#if LL_WINDOWS
- LLError::addRecorder(new RecordToWinDebug);
+ LLError::RecorderPtr recordToWinDebug(new RecordToWinDebug());
+ LLError::addRecorder(recordToWinDebug);
#endif
LogControlFile& e = LogControlFile::fromDirectory(dir);
@@ -645,7 +646,8 @@ namespace LLError
}
commonInit(dir);
#if !LL_WINDOWS
- addRecorder(new RecordToSyslog(identity));
+ LLError::RecorderPtr recordToSyslog(new RecordToSyslog(identity));
+ addRecorder(recordToSyslog);
#endif
}
@@ -656,72 +658,67 @@ namespace LLError
void setPrintLocation(bool print)
{
- Settings& s = Settings::get();
- s.mPrintLocation = print;
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ s->mPrintLocation = print;
}
void setFatalFunction(const FatalFunction& f)
{
- Settings& s = Settings::get();
- s.mCrashFunction = f;
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ s->mCrashFunction = f;
}
FatalFunction getFatalFunction()
{
- Settings& s = Settings::get();
- return s.mCrashFunction;
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ return s->mCrashFunction;
}
void setTimeFunction(TimeFunction f)
{
- Settings& s = Settings::get();
- s.mTimeFunction = f;
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ s->mTimeFunction = f;
}
void setDefaultLevel(ELevel level)
{
- Globals& g = Globals::get();
- Settings& s = Settings::get();
- g.invalidateCallSites();
- s.mDefaultLevel = level;
+ Globals::getInstance()->invalidateCallSites();
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ s->mDefaultLevel = level;
}
ELevel getDefaultLevel()
{
- Settings& s = Settings::get();
- return s.mDefaultLevel;
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ return s->mDefaultLevel;
}
void setFunctionLevel(const std::string& function_name, ELevel level)
{
- Globals& g = Globals::get();
- Settings& s = Settings::get();
- g.invalidateCallSites();
- s.mFunctionLevelMap[function_name] = level;
+ Globals::getInstance()->invalidateCallSites();
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ s->mFunctionLevelMap[function_name] = level;
}
void setClassLevel(const std::string& class_name, ELevel level)
{
- Globals& g = Globals::get();
- Settings& s = Settings::get();
- g.invalidateCallSites();
- s.mClassLevelMap[class_name] = level;
+ Globals::getInstance()->invalidateCallSites();
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ s->mClassLevelMap[class_name] = level;
}
void setFileLevel(const std::string& file_name, ELevel level)
{
- Globals& g = Globals::get();
- Settings& s = Settings::get();
- g.invalidateCallSites();
- s.mFileLevelMap[file_name] = level;
+ Globals::getInstance()->invalidateCallSites();
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ s->mFileLevelMap[file_name] = level;
}
void setTagLevel(const std::string& tag_name, ELevel level)
{
- Globals& g = Globals::get();
- Settings& s = Settings::get();
- g.invalidateCallSites();
- s.mTagLevelMap[tag_name] = level;
+ Globals::getInstance()->invalidateCallSites();
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ s->mTagLevelMap[tag_name] = level;
}
LLError::ELevel decodeLevel(std::string name)
@@ -765,15 +762,14 @@ namespace LLError
{
void configure(const LLSD& config)
{
- Globals& g = Globals::get();
- Settings& s = Settings::get();
+ Globals::getInstance()->invalidateCallSites();
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
- g.invalidateCallSites();
- s.mFunctionLevelMap.clear();
- s.mClassLevelMap.clear();
- s.mFileLevelMap.clear();
- s.mTagLevelMap.clear();
- s.mUniqueLogMessages.clear();
+ s->mFunctionLevelMap.clear();
+ s->mClassLevelMap.clear();
+ s->mFileLevelMap.clear();
+ s->mTagLevelMap.clear();
+ s->mUniqueLogMessages.clear();
setPrintLocation(config["print-location"]);
setDefaultLevel(decodeLevel(config["default-level"]));
@@ -786,10 +782,10 @@ namespace LLError
ELevel level = decodeLevel(entry["level"]);
- setLevels(s.mFunctionLevelMap, entry["functions"], level);
- setLevels(s.mClassLevelMap, entry["classes"], level);
- setLevels(s.mFileLevelMap, entry["files"], level);
- setLevels(s.mTagLevelMap, entry["tags"], level);
+ setLevels(s->mFunctionLevelMap, entry["functions"], level);
+ setLevels(s->mClassLevelMap, entry["classes"], level);
+ setLevels(s->mFileLevelMap, entry["files"], level);
+ setLevels(s->mTagLevelMap, entry["tags"], level);
}
}
}
@@ -803,10 +799,12 @@ namespace LLError
mWantsLevel(true),
mWantsLocation(false),
mWantsFunctionName(true)
- {}
+ {
+ }
Recorder::~Recorder()
- { }
+ {
+ }
bool Recorder::wantsTime()
{
@@ -837,25 +835,25 @@ namespace LLError
return mWantsFunctionName;
}
- void addRecorder(Recorder* recorder)
+ void addRecorder(RecorderPtr recorder)
{
- if (recorder == NULL)
+ if (!recorder)
{
return;
}
- Settings& s = Settings::get();
- s.mRecorders.push_back(recorder);
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ s->mRecorders.push_back(recorder);
}
- void removeRecorder(Recorder* recorder)
+ void removeRecorder(RecorderPtr recorder)
{
- if (recorder == NULL)
+ if (!recorder)
{
return;
}
- Settings& s = Settings::get();
- s.mRecorders.erase(std::remove(s.mRecorders.begin(), s.mRecorders.end(), recorder),
- s.mRecorders.end());
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ s->mRecorders.erase(std::remove(s->mRecorders.begin(), s->mRecorders.end(), recorder),
+ s->mRecorders.end());
}
}
@@ -863,51 +861,47 @@ namespace LLError
{
void logToFile(const std::string& file_name)
{
- LLError::Settings& s = LLError::Settings::get();
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
- removeRecorder(s.mFileRecorder);
- delete s.mFileRecorder;
- s.mFileRecorder = NULL;
- s.mFileRecorderFileName.clear();
+ removeRecorder(s->mFileRecorder);
+ s->mFileRecorder.reset();
+ s->mFileRecorderFileName.clear();
if (file_name.empty())
{
return;
}
- RecordToFile* f = new RecordToFile(file_name);
- if (!f->okay())
+ RecorderPtr recordToFile(new RecordToFile(file_name));
+ if (boost::dynamic_pointer_cast<RecordToFile>(recordToFile)->okay())
{
- delete f;
- return;
+ s->mFileRecorderFileName = file_name;
+ s->mFileRecorder = recordToFile;
+ addRecorder(recordToFile);
}
-
- s.mFileRecorderFileName = file_name;
- s.mFileRecorder = f;
- addRecorder(f);
}
void logToFixedBuffer(LLLineBuffer* fixedBuffer)
{
- LLError::Settings& s = LLError::Settings::get();
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
- removeRecorder(s.mFixedBufferRecorder);
- delete s.mFixedBufferRecorder;
- s.mFixedBufferRecorder = NULL;
+ removeRecorder(s->mFixedBufferRecorder);
+ s->mFixedBufferRecorder.reset();
if (!fixedBuffer)
{
return;
}
- s.mFixedBufferRecorder = new RecordToFixedBuffer(fixedBuffer);
- addRecorder(s.mFixedBufferRecorder);
+ RecorderPtr recordToFixedBuffer(new RecordToFixedBuffer(fixedBuffer));
+ s->mFixedBufferRecorder = recordToFixedBuffer;
+ addRecorder(recordToFixedBuffer);
}
std::string logFileName()
{
- LLError::Settings& s = LLError::Settings::get();
- return s.mFileRecorderFileName;
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ return s->mFileRecorderFileName;
}
}
@@ -916,24 +910,24 @@ namespace
void writeToRecorders(const LLError::CallSite& site, const std::string& message, bool show_location = true, bool show_time = true, bool show_tags = true, bool show_level = true, bool show_function = true)
{
LLError::ELevel level = site.mLevel;
- LLError::Settings& s = LLError::Settings::get();
+ LLError::SettingsConfigPtr s = LLError::Settings::getInstance()->getSettingsConfig();
- for (Recorders::const_iterator i = s.mRecorders.begin();
- i != s.mRecorders.end();
+ for (Recorders::const_iterator i = s->mRecorders.begin();
+ i != s->mRecorders.end();
++i)
{
- LLError::Recorder* r = *i;
+ LLError::RecorderPtr r = *i;
std::ostringstream message_stream;
- if (show_location && (r->wantsLocation() || level == LLError::LEVEL_ERROR || s.mPrintLocation))
+ if (show_location && (r->wantsLocation() || level == LLError::LEVEL_ERROR || s->mPrintLocation))
{
message_stream << site.mLocationString << " ";
}
- if (show_time && r->wantsTime() && s.mTimeFunction != NULL)
+ if (show_time && r->wantsTime() && s->mTimeFunction != NULL)
{
- message_stream << s.mTimeFunction() << " ";
+ message_stream << s->mTimeFunction() << " ";
}
if (show_level && r->wantsLevel())
@@ -1060,10 +1054,9 @@ namespace LLError
return false;
}
- Globals& g = Globals::get();
- Settings& s = Settings::get();
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
- s.mShouldLogCallCounter++;
+ s->mShouldLogCallCounter++;
const std::string& class_name = className(site.mClassInfo);
std::string function_name = functionName(site.mFunction);
@@ -1077,21 +1070,21 @@ namespace LLError
function_name = class_name + "::" + function_name;
}
- ELevel compareLevel = s.mDefaultLevel;
+ ELevel compareLevel = s->mDefaultLevel;
// The most specific match found will be used as the log level,
// since the computation short circuits.
// So, in increasing order of importance:
// Default < Tags < File < Class < Function
- checkLevelMap(s.mFunctionLevelMap, function_name, compareLevel)
- || checkLevelMap(s.mClassLevelMap, class_name, compareLevel)
- || checkLevelMap(s.mFileLevelMap, abbreviateFile(site.mFile), compareLevel)
+ checkLevelMap(s->mFunctionLevelMap, function_name, compareLevel)
+ || checkLevelMap(s->mClassLevelMap, class_name, compareLevel)
+ || checkLevelMap(s->mFileLevelMap, abbreviateFile(site.mFile), compareLevel)
|| (site.mTagCount > 0
- ? checkLevelMap(s.mTagLevelMap, site.mTags, site.mTagCount, compareLevel)
+ ? checkLevelMap(s->mTagLevelMap, site.mTags, site.mTagCount, compareLevel)
: false);
site.mCached = true;
- g.addCallSite(site);
+ Globals::getInstance()->addCallSite(site);
return site.mShouldLog = site.mLevel >= compareLevel;
}
@@ -1101,12 +1094,12 @@ namespace LLError
LogLock lock;
if (lock.ok())
{
- Globals& g = Globals::get();
+ Globals* g = Globals::getInstance();
- if (!g.messageStreamInUse)
+ if (!g->messageStreamInUse)
{
- g.messageStreamInUse = true;
- return &g.messageStream;
+ g->messageStreamInUse = true;
+ return &g->messageStream;
}
}
@@ -1131,13 +1124,12 @@ namespace LLError
message[127] = '\0' ;
}
- Globals& g = Globals::get();
-
- if (out == &g.messageStream)
+ Globals* g = Globals::getInstance();
+ if (out == &g->messageStream)
{
- g.messageStream.clear();
- g.messageStream.str("");
- g.messageStreamInUse = false;
+ g->messageStream.clear();
+ g->messageStream.str("");
+ g->messageStreamInUse = false;
}
else
{
@@ -1154,15 +1146,15 @@ namespace LLError
return;
}
- Globals& g = Globals::get();
- Settings& s = Settings::get();
+ Globals* g = Globals::getInstance();
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
std::string message = out->str();
- if (out == &g.messageStream)
+ if (out == &g->messageStream)
{
- g.messageStream.clear();
- g.messageStream.str("");
- g.messageStreamInUse = false;
+ g->messageStream.clear();
+ g->messageStream.str("");
+ g->messageStreamInUse = false;
}
else
{
@@ -1178,8 +1170,8 @@ namespace LLError
if (site.mPrintOnce)
{
- std::map<std::string, unsigned int>::iterator messageIter = s.mUniqueLogMessages.find(message);
- if (messageIter != s.mUniqueLogMessages.end())
+ std::map<std::string, unsigned int>::iterator messageIter = s->mUniqueLogMessages.find(message);
+ if (messageIter != s->mUniqueLogMessages.end())
{
messageIter->second++;
unsigned int num_messages = messageIter->second;
@@ -1195,7 +1187,7 @@ namespace LLError
else
{
message_stream << "ONCE: ";
- s.mUniqueLogMessages[message] = 1;
+ s->mUniqueLogMessages[message] = 1;
}
}
@@ -1203,23 +1195,23 @@ namespace LLError
writeToRecorders(site, message_stream.str());
- if (site.mLevel == LEVEL_ERROR && s.mCrashFunction)
+ if (site.mLevel == LEVEL_ERROR && s->mCrashFunction)
{
- s.mCrashFunction(message_stream.str());
+ s->mCrashFunction(message_stream.str());
}
}
}
namespace LLError
{
- Settings* saveAndResetSettings()
+ SettingsStoragePtr saveAndResetSettings()
{
- return Settings::saveAndReset();
+ return Settings::getInstance()->saveAndReset();
}
- void restoreSettings(Settings* s)
+ void restoreSettings(SettingsStoragePtr pSettingsStorage)
{
- return Settings::restore(s);
+ return Settings::getInstance()->restore(pSettingsStorage);
}
std::string removePrefix(std::string& s, const std::string& p)
@@ -1265,8 +1257,8 @@ namespace LLError
int shouldLogCallCount()
{
- Settings& s = Settings::get();
- return s.mShouldLogCallCounter;
+ SettingsConfigPtr s = Settings::getInstance()->getSettingsConfig();
+ return s->mShouldLogCallCounter;
}
#if LL_WINDOWS
@@ -1375,15 +1367,9 @@ namespace LLError
#endif
//static
- void LLCallStacks::push(const char* function, const int line)
+ void LLCallStacks::allocateStackBuffer()
{
- CallStacksLogLock lock;
- if (!lock.ok())
- {
- return;
- }
-
- if(!sBuffer)
+ if(sBuffer == NULL)
{
sBuffer = new char*[512] ;
sBuffer[0] = new char[512 * 128] ;
@@ -1393,6 +1379,31 @@ namespace LLError
}
sIndex = 0 ;
}
+ }
+
+ void LLCallStacks::freeStackBuffer()
+ {
+ if(sBuffer != NULL)
+ {
+ delete [] sBuffer[0] ;
+ delete [] sBuffer ;
+ sBuffer = NULL ;
+ }
+ }
+
+ //static
+ void LLCallStacks::push(const char* function, const int line)
+ {
+ CallStacksLogLock lock;
+ if (!lock.ok())
+ {
+ return;
+ }
+
+ if(sBuffer == NULL)
+ {
+ allocateStackBuffer();
+ }
if(sIndex > 511)
{
@@ -1424,15 +1435,9 @@ namespace LLError
return;
}
- if(!sBuffer)
+ if(sBuffer == NULL)
{
- sBuffer = new char*[512] ;
- sBuffer[0] = new char[512 * 128] ;
- for(S32 i = 1 ; i < 512 ; i++)
- {
- sBuffer[i] = sBuffer[i-1] + 128 ;
- }
- sIndex = 0 ;
+ allocateStackBuffer();
}
if(sIndex > 511)
@@ -1463,11 +1468,9 @@ namespace LLError
LL_INFOS() << " *************** END OF LL CALL STACKS *************** " << LL_ENDL;
}
- if(sBuffer)
+ if(sBuffer != NULL)
{
- delete[] sBuffer[0] ;
- delete[] sBuffer ;
- sBuffer = NULL ;
+ freeStackBuffer();
}
}
@@ -1477,5 +1480,10 @@ namespace LLError
sIndex = 0 ;
}
+ //static
+ void LLCallStacks::cleanup()
+ {
+ freeStackBuffer();
+ }
}
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index bc80e64423..63040e1772 100755
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -261,6 +261,9 @@ namespace LLError
private:
static char** sBuffer ;
static S32 sIndex ;
+
+ static void allocateStackBuffer();
+ static void freeStackBuffer();
public:
static void push(const char* function, const int line) ;
@@ -268,6 +271,7 @@ namespace LLError
static void print() ;
static void clear() ;
static void end(std::ostringstream* _out) ;
+ static void cleanup();
};
}
diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h
index aab695094c..56ac52e5de 100755
--- a/indra/llcommon/llerrorcontrol.h
+++ b/indra/llcommon/llerrorcontrol.h
@@ -29,7 +29,10 @@
#define LL_LLERRORCONTROL_H
#include "llerror.h"
+#include "llpointer.h"
+#include "llrefcount.h"
#include "boost/function.hpp"
+#include "boost/shared_ptr.hpp"
#include <string>
class LLSD;
@@ -156,16 +159,14 @@ namespace LLError
mWantsFunctionName;
};
+ typedef boost::shared_ptr<Recorder> RecorderPtr;
+
/**
- * @NOTE: addRecorder() conveys ownership to the underlying Settings
- * object -- when destroyed, it will @em delete the passed Recorder*!
- */
- LL_COMMON_API void addRecorder(Recorder*);
- /**
- * @NOTE: removeRecorder() reclaims ownership of the Recorder*: its
- * lifespan becomes the caller's problem.
+ * @NOTE: addRecorder() and removeRecorder() uses the boost::shared_ptr to allow for shared ownership
+ * while still ensuring that the allocated memory is eventually freed
*/
- LL_COMMON_API void removeRecorder(Recorder*);
+ LL_COMMON_API void addRecorder(RecorderPtr);
+ LL_COMMON_API void removeRecorder(RecorderPtr);
// each error message is passed to each recorder via recordMessage()
LL_COMMON_API void logToFile(const std::string& filename);
@@ -182,9 +183,9 @@ namespace LLError
Utilities for use by the unit tests of LLError itself.
*/
- class Settings;
- LL_COMMON_API Settings* saveAndResetSettings();
- LL_COMMON_API void restoreSettings(Settings *);
+ typedef LLPointer<LLRefCount> SettingsStoragePtr;
+ LL_COMMON_API SettingsStoragePtr saveAndResetSettings();
+ LL_COMMON_API void restoreSettings(SettingsStoragePtr pSettingsStorage);
LL_COMMON_API std::string abbreviateFile(const std::string& filePath);
LL_COMMON_API int shouldLogCallCount();
diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp
index b28c5ba4b3..a5aaff10c5 100755
--- a/indra/llcommon/tests/llerror_test.cpp
+++ b/indra/llcommon/tests/llerror_test.cpp
@@ -56,9 +56,9 @@ namespace tut
{
public:
TestRecorder() { mWantsTime = false; }
- ~TestRecorder() { LLError::removeRecorder(this); }
+ virtual ~TestRecorder() { }
- void recordMessage(LLError::ELevel level,
+ virtual void recordMessage(LLError::ELevel level,
const std::string& message)
{
mMessages.push_back(message);
@@ -85,15 +85,11 @@ namespace tut
struct ErrorTestData
{
- // addRecorder() expects to be able to later delete the passed
- // Recorder*. Even though removeRecorder() reclaims ownership, passing
- // a pointer to a data member rather than a heap Recorder subclass
- // instance would just be Wrong.
- TestRecorder* mRecorder;
- LLError::Settings* mPriorErrorSettings;
+ LLError::RecorderPtr mRecorder;
+ LLError::SettingsStoragePtr mPriorErrorSettings;
ErrorTestData():
- mRecorder(new TestRecorder)
+ mRecorder(new TestRecorder())
{
fatalWasCalled = false;
@@ -106,13 +102,32 @@ namespace tut
~ErrorTestData()
{
LLError::removeRecorder(mRecorder);
- delete mRecorder;
LLError::restoreSettings(mPriorErrorSettings);
}
+ int countMessages()
+ {
+ return boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->countMessages();
+ }
+
+ void clearMessages()
+ {
+ boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->clearMessages();
+ }
+
+ void setWantsTime(bool t)
+ {
+ boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->setWantsTime(t);
+ }
+
+ std::string message(int n)
+ {
+ return boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->message(n);
+ }
+
void ensure_message_count(int expectedCount)
{
- ensure_equals("message count", mRecorder->countMessages(), expectedCount);
+ ensure_equals("message count", countMessages(), expectedCount);
}
void ensure_message_contains(int n, const std::string& expectedText)
@@ -120,7 +135,7 @@ namespace tut
std::ostringstream test_name;
test_name << "testing message " << n;
- ensure_contains(test_name.str(), mRecorder->message(n), expectedText);
+ ensure_contains(test_name.str(), message(n), expectedText);
}
void ensure_message_does_not_contain(int n, const std::string& expectedText)
@@ -128,7 +143,7 @@ namespace tut
std::ostringstream test_name;
test_name << "testing message " << n;
- ensure_does_not_contain(test_name.str(), mRecorder->message(n), expectedText);
+ ensure_does_not_contain(test_name.str(), message(n), expectedText);
}
};
@@ -385,15 +400,15 @@ namespace
}
typedef std::string (*LogFromFunction)(bool);
- void testLogName(tut::TestRecorder* recorder, LogFromFunction f,
+ void testLogName(LLError::RecorderPtr recorder, LogFromFunction f,
const std::string& class_name = "")
{
- recorder->clearMessages();
+ boost::dynamic_pointer_cast<tut::TestRecorder>(recorder)->clearMessages();
std::string name = f(false);
f(true);
- std::string messageWithoutName = recorder->message(0);
- std::string messageWithName = recorder->message(1);
+ std::string messageWithoutName = boost::dynamic_pointer_cast<tut::TestRecorder>(recorder)->message(0);
+ std::string messageWithName = boost::dynamic_pointer_cast<tut::TestRecorder>(recorder)->message(1);
ensure_has(name + " logged without name",
messageWithoutName, name);
@@ -528,12 +543,12 @@ namespace tut
{
LLError::setTimeFunction(roswell);
- mRecorder->setWantsTime(false);
+ setWantsTime(false);
ufoSighting();
ensure_message_contains(0, "ufo");
ensure_message_does_not_contain(0, roswell());
- mRecorder->setWantsTime(true);
+ setWantsTime(true);
ufoSighting();
ensure_message_contains(1, "ufo");
ensure_message_contains(1, roswell());
@@ -545,13 +560,13 @@ namespace tut
{
LLError::setPrintLocation(true);
LLError::setTimeFunction(roswell);
- mRecorder->setWantsTime(true);
+ setWantsTime(true);
std::string location,
function;
writeReturningLocationAndFunction(location, function);
ensure_equals("order is location time type function message",
- mRecorder->message(0),
+ message(0),
location + roswell() + " INFO: " + function + ": apple");
}
@@ -559,19 +574,19 @@ namespace tut
// multiple recorders
void ErrorTestObject::test<11>()
{
- TestRecorder* altRecorder(new TestRecorder);
+ LLError::RecorderPtr altRecorder(new TestRecorder());
LLError::addRecorder(altRecorder);
LL_INFOS() << "boo" << LL_ENDL;
ensure_message_contains(0, "boo");
- ensure_equals("alt recorder count", altRecorder->countMessages(), 1);
- ensure_contains("alt recorder message 0", altRecorder->message(0), "boo");
+ ensure_equals("alt recorder count", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->countMessages(), 1);
+ ensure_contains("alt recorder message 0", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->message(0), "boo");
LLError::setTimeFunction(roswell);
- TestRecorder* anotherRecorder(new TestRecorder);
- anotherRecorder->setWantsTime(true);
+ LLError::RecorderPtr anotherRecorder(new TestRecorder());
+ boost::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->setWantsTime(true);
LLError::addRecorder(anotherRecorder);
LL_INFOS() << "baz" << LL_ENDL;
@@ -579,10 +594,13 @@ namespace tut
std::string when = roswell();
ensure_message_does_not_contain(1, when);
- ensure_equals("alt recorder count", altRecorder->countMessages(), 2);
- ensure_does_not_contain("alt recorder message 1", altRecorder->message(1), when);
- ensure_equals("another recorder count", anotherRecorder->countMessages(), 1);
- ensure_contains("another recorder message 0", anotherRecorder->message(0), when);
+ ensure_equals("alt recorder count", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->countMessages(), 2);
+ ensure_does_not_contain("alt recorder message 1", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->message(1), when);
+ ensure_equals("another recorder count", boost::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->countMessages(), 1);
+ ensure_contains("another recorder message 0", boost::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->message(0), when);
+
+ LLError::removeRecorder(altRecorder);
+ LLError::removeRecorder(anotherRecorder);
}
}
diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h
index 3137bd8fea..785197ba11 100755
--- a/indra/llcommon/tests/wrapllerrs.h
+++ b/indra/llcommon/tests/wrapllerrs.h
@@ -38,6 +38,7 @@
#include "stringize.h"
#include <boost/bind.hpp>
#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
#include <list>
#include <string>
#include <stdexcept>
@@ -81,72 +82,29 @@ struct WrapLLErrs
}
std::string error;
- LLError::Settings* mPriorErrorSettings;
+ LLError::SettingsStoragePtr mPriorErrorSettings;
LLError::FatalFunction mPriorFatal;
};
/**
- * LLError::addRecorder() accepts ownership of the passed Recorder* -- it
- * expects to be able to delete it later. CaptureLog isa Recorder whose
- * pointer we want to be able to pass without any ownership implications.
- * For such cases, instantiate a new RecorderProxy(yourRecorder) and pass
- * that. Your heap RecorderProxy might later be deleted, but not yourRecorder.
- */
-class RecorderProxy: public LLError::Recorder
-{
-public:
- RecorderProxy(LLError::Recorder* recorder):
- mRecorder(recorder)
- {}
-
- virtual void recordMessage(LLError::ELevel level, const std::string& message)
- {
- mRecorder->recordMessage(level, message);
- }
-
- virtual bool wantsTime()
- {
- return mRecorder->wantsTime();
- }
-
-private:
- LLError::Recorder* mRecorder;
-};
-
-/**
* Capture log messages. This is adapted (simplified) from the one in
* llerror_test.cpp.
*/
-class CaptureLog : public LLError::Recorder, public boost::noncopyable
+class CaptureLogRecorder : public LLError::Recorder, public boost::noncopyable
{
public:
- CaptureLog(LLError::ELevel level=LLError::LEVEL_DEBUG):
- // Mostly what we're trying to accomplish by saving and resetting
- // LLError::Settings is to bypass the default RecordToStderr and
- // RecordToWinDebug Recorders. As these are visible only inside
- // llerror.cpp, we can't just call LLError::removeRecorder() with
- // each. For certain tests we need to produce, capture and examine
- // DEBUG log messages -- but we don't want to spam the user's console
- // with that output. If it turns out that saveAndResetSettings() has
- // some bad effect, give up and just let the DEBUG level log messages
- // display.
- mOldSettings(LLError::saveAndResetSettings()),
- mProxy(new RecorderProxy(this))
+ CaptureLogRecorder()
+ : LLError::Recorder(),
+ boost::noncopyable(),
+ mMessages()
{
- LLError::setFatalFunction(wouldHaveCrashed);
- LLError::setDefaultLevel(level);
- LLError::addRecorder(mProxy);
}
- ~CaptureLog()
+ virtual ~CaptureLogRecorder()
{
- LLError::removeRecorder(mProxy);
- delete mProxy;
- LLError::restoreSettings(mOldSettings);
}
- void recordMessage(LLError::ELevel level,
- const std::string& message)
+ virtual void recordMessage(LLError::ELevel level, const std::string& message)
{
mMessages.push_back(message);
}
@@ -154,7 +112,7 @@ public:
/// Don't assume the message we want is necessarily the LAST log message
/// emitted by the underlying code; search backwards through all messages
/// for the sought string.
- std::string messageWith(const std::string& search, bool required=true)
+ std::string messageWith(const std::string& search, bool required)
{
for (MessageList::const_reverse_iterator rmi(mMessages.rbegin()), rmend(mMessages.rend());
rmi != rmend; ++rmi)
@@ -187,14 +145,63 @@ public:
return out;
}
+private:
typedef std::list<std::string> MessageList;
MessageList mMessages;
- LLError::Settings* mOldSettings;
- LLError::Recorder* mProxy;
+};
+
+/**
+ * Capture log messages. This is adapted (simplified) from the one in
+ * llerror_test.cpp.
+ */
+class CaptureLog : public boost::noncopyable
+{
+public:
+ CaptureLog(LLError::ELevel level=LLError::LEVEL_DEBUG)
+ // Mostly what we're trying to accomplish by saving and resetting
+ // LLError::Settings is to bypass the default RecordToStderr and
+ // RecordToWinDebug Recorders. As these are visible only inside
+ // llerror.cpp, we can't just call LLError::removeRecorder() with
+ // each. For certain tests we need to produce, capture and examine
+ // DEBUG log messages -- but we don't want to spam the user's console
+ // 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(),
+ mOldSettings(LLError::saveAndResetSettings()),
+ mRecorder(new CaptureLogRecorder())
+ {
+ LLError::setFatalFunction(wouldHaveCrashed);
+ LLError::setDefaultLevel(level);
+ LLError::addRecorder(mRecorder);
+ }
+
+ ~CaptureLog()
+ {
+ LLError::removeRecorder(mRecorder);
+ LLError::restoreSettings(mOldSettings);
+ }
+
+ /// Don't assume the message we want is necessarily the LAST log message
+ /// emitted by the underlying code; search backwards through all messages
+ /// for the sought string.
+ std::string messageWith(const std::string& search, bool required=true)
+ {
+ 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);
+ }
+
+private:
+ LLError::SettingsStoragePtr mOldSettings;
+ LLError::RecorderPtr mRecorder;
};
inline
-std::ostream& operator<<(std::ostream& out, const CaptureLog& log)
+std::ostream& operator<<(std::ostream& out, const CaptureLogRecorder& log)
{
return log.streamto(out);
}
diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp
index 81e28121fd..9f90ae1544 100755
--- a/indra/llmessage/llares.cpp
+++ b/indra/llmessage/llares.cpp
@@ -610,6 +610,15 @@ LLAres *ll_init_ares()
return gAres;
}
+void ll_cleanup_ares()
+{
+ if (gAres != NULL)
+ {
+ delete gAres;
+ gAres = NULL;
+ }
+}
+
LLDnsRecord::LLDnsRecord(LLResType type, const std::string &name,
unsigned ttl)
: LLRefCount(),
diff --git a/indra/llmessage/llares.h b/indra/llmessage/llares.h
index 800781ee88..0b5d49e322 100755
--- a/indra/llmessage/llares.h
+++ b/indra/llmessage/llares.h
@@ -578,5 +578,6 @@ extern LLAres *gAres;
* thread safe.
*/
extern LLAres *ll_init_ares();
+extern void ll_cleanup_ares();
#endif // LL_LLARES_H
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 147940c983..161b7c1615 100755
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -274,6 +274,36 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle)
}
}
+//static
+void LLCurl::Easy::deleteAllActiveHandles()
+{
+ LLMutexLock lock(sHandleMutexp) ;
+ LL_CHECK_MEMORY
+ for (std::set<CURL*>::iterator activeHandle = sActiveHandles.begin(); activeHandle != sActiveHandles.end(); ++activeHandle)
+ {
+ CURL* curlHandle = *activeHandle;
+ LLCurl::deleteEasyHandle(curlHandle);
+ LL_CHECK_MEMORY
+ }
+
+ sFreeHandles.clear();
+}
+
+//static
+void LLCurl::Easy::deleteAllFreeHandles()
+{
+ LLMutexLock lock(sHandleMutexp) ;
+ LL_CHECK_MEMORY
+ for (std::set<CURL*>::iterator freeHandle = sFreeHandles.begin(); freeHandle != sFreeHandles.end(); ++freeHandle)
+ {
+ CURL* curlHandle = *freeHandle;
+ LLCurl::deleteEasyHandle(curlHandle);
+ LL_CHECK_MEMORY
+ }
+
+ sFreeHandles.clear();
+}
+
LLCurl::Easy::Easy()
: mHeaders(NULL),
mCurlEasyHandle(NULL)
@@ -1745,17 +1775,14 @@ void LLCurl::cleanupClass()
#endif
LL_CHECK_MEMORY
-
- for (std::set<CURL*>::iterator iter = Easy::sFreeHandles.begin(); iter != Easy::sFreeHandles.end(); ++iter)
- {
- CURL* curl = *iter;
- LLCurl::deleteEasyHandle(curl);
- }
-
+ Easy::deleteAllFreeHandles();
+ LL_CHECK_MEMORY
+ Easy::deleteAllActiveHandles();
LL_CHECK_MEMORY
- Easy::sFreeHandles.clear();
-
+ // Free the template easy handle
+ curl_easy_cleanup(sCurlTemplateStandardHandle);
+ sCurlTemplateStandardHandle = NULL;
LL_CHECK_MEMORY
delete Easy::sHandleMutexp ;
diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h
index fc9761ff9f..b033a3d4ab 100755
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -269,6 +269,9 @@ private:
static std::set<CURL*> sFreeHandles;
static std::set<CURL*> sActiveHandles;
static LLMutex* sHandleMutexp ;
+
+ static void deleteAllActiveHandles();
+ static void deleteAllFreeHandles();
};
class LLCurl::Multi
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 31a499b370..21d459b832 100755
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -124,7 +124,7 @@ namespace
{
public:
RawInjector(const U8* data, S32 size) : mData(data), mSize(size) {}
- virtual ~RawInjector() {delete mData;}
+ virtual ~RawInjector() {delete [] mData;}
const char* contentType() { return "application/octet-stream"; }
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index ddf38c6745..ebed454271 100755
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -390,9 +390,7 @@ LLImageGL::~LLImageGL()
{
LLImageGL::cleanup();
sImageList.erase(this);
- disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8);
- delete [] mPickMask;
- mPickMask = NULL;
+ freePickMask();
sCount--;
}
@@ -461,6 +459,8 @@ void LLImageGL::cleanup()
{
destroyGLTexture();
}
+ freePickMask();
+
mSaveData = NULL; // deletes data
}
@@ -504,10 +504,7 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents, S32 discard_leve
}
// pickmask validity depends on old image size, delete it
- disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8);
- delete [] mPickMask;
- mPickMask = NULL;
- mPickMaskWidth = mPickMaskHeight = 0;
+ freePickMask();
mWidth = width;
mHeight = height;
@@ -1886,6 +1883,37 @@ void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h)
}
//----------------------------------------------------------------------------
+U32 LLImageGL::createPickMask(S32 pWidth, S32 pHeight)
+{
+ U32 pick_width = pWidth/2 + 1;
+ U32 pick_height = pHeight/2 + 1;
+
+ U32 size = pick_width * pick_height;
+ size = (size + 7) / 8; // pixelcount-to-bits
+ mPickMask = new U8[size];
+ claimMem(size);
+ mPickMaskWidth = pick_width - 1;
+ mPickMaskHeight = pick_height - 1;
+
+ memset(mPickMask, 0, sizeof(U8) * size);
+
+ return size;
+}
+
+//----------------------------------------------------------------------------
+void LLImageGL::freePickMask()
+{
+ // pickmask validity depends on old image size, delete it
+ if (mPickMask != NULL)
+ {
+ disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8);
+ delete [] mPickMask;
+ }
+ mPickMask = NULL;
+ mPickMaskWidth = mPickMaskHeight = 0;
+}
+
+//----------------------------------------------------------------------------
void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in)
{
if(!mNeedsAlphaAndPickMask)
@@ -1893,10 +1921,7 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in)
return ;
}
- disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8);
- delete [] mPickMask;
- mPickMask = NULL;
- mPickMaskWidth = mPickMaskHeight = 0;
+ freePickMask();
if (mFormatType != GL_UNSIGNED_BYTE ||
mFormatPrimary != GL_RGBA)
@@ -1905,17 +1930,11 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in)
return;
}
- U32 pick_width = width/2 + 1;
- U32 pick_height = height/2 + 1;
-
- U32 size = pick_width * pick_height;
- size = (size + 7) / 8; // pixelcount-to-bits
- mPickMask = new U8[size];
- claimMem(size);
- mPickMaskWidth = pick_width - 1;
- mPickMaskHeight = pick_height - 1;
-
- memset(mPickMask, 0, sizeof(U8) * size);
+#ifdef SHOW_ASSERT
+ const U32 pickSize = createPickMask(width, height);
+#else // SHOW_ASSERT
+ createPickMask(width, height);
+#endif // SHOW_ASSERT
U32 pick_bit = 0;
@@ -1929,7 +1948,7 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in)
{
U32 pick_idx = pick_bit/8;
U32 pick_offset = pick_bit%8;
- llassert(pick_idx < size);
+ llassert(pick_idx < pickSize);
mPickMask[pick_idx] |= 1 << pick_offset;
}
diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h
index 6ca814af6f..21982eab1d 100755
--- a/indra/llrender/llimagegl.h
+++ b/indra/llrender/llimagegl.h
@@ -186,6 +186,9 @@ public:
mutable F32 mLastBindTime; // last time this was bound, by discard level
private:
+ U32 createPickMask(S32 pWidth, S32 pHeight);
+ void freePickMask();
+
LLPointer<LLImageRaw> mSaveData; // used for destroyGL/restoreGL
U8* mPickMask; //downsampled bitmap approximation of alpha channel. NULL if no alpha channel
U16 mPickMaskWidth;
diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp
index 1860a05edd..9b2a9569f7 100755
--- a/indra/llui/llbadgeowner.cpp
+++ b/indra/llui/llbadgeowner.cpp
@@ -45,6 +45,7 @@ void LLBadgeOwner::initBadgeParams(const LLBadge::Params& p)
if (!p.equals(LLUICtrlFactory::getDefaultParams<LLBadge>()))
{
mBadge = createBadge(p);
+ addBadgeToParentPanel();
}
}
@@ -53,7 +54,6 @@ void LLBadgeOwner::setBadgeLabel(const LLStringExplicit& label)
if (mBadge == NULL)
{
mBadge = createBadge(LLUICtrlFactory::getDefaultParams<LLBadge>());
-
addBadgeToParentPanel();
}
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index b92e298348..0568388f56 100755
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -227,10 +227,11 @@ LLFolderView::LLFolderView(const Params& p)
mStatusTextBox = LLUICtrlFactory::create<LLTextBox> (text_p);
mStatusTextBox->setFollowsLeft();
mStatusTextBox->setFollowsTop();
- //addChild(mStatusTextBox);
+ addChild(mStatusTextBox);
// make the popup menu available
+ llassert(LLMenuGL::sMenuContainer != NULL);
LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(p.options_menu, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
if (!menu)
{
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index d410a2de33..b09c927782 100755
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -192,6 +192,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
setPrevalidateInput(p.prevalidate_input_callback());
setPrevalidate(p.prevalidate_callback());
+ llassert(LLMenuGL::sMenuContainer != NULL);
LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile<LLContextMenu>
("menu_text_editor.xml",
LLMenuGL::sMenuContainer,
diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp
index 0609cd8b42..303afcda15 100755
--- a/indra/llui/llmenubutton.cpp
+++ b/indra/llui/llmenubutton.cpp
@@ -93,6 +93,7 @@ void LLMenuButton::setMenu(const std::string& menu_filename, EMenuPosition posit
return;
}
+ llassert(LLMenuGL::sMenuContainer != NULL);
LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
if (!menu)
{
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 3708071e11..5f72ee3ac6 100755
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -1815,6 +1815,7 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
// create the context menu from the XUI file and display it
std::string menu_name = is_group ? "menu_url_group.xml" : "menu_url_agent.xml";
delete mPopupMenu;
+ llassert(LLMenuGL::sMenuContainer != NULL);
mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
menu_name, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
if (mPopupMenu)
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index ebc6183b8b..6f858cdeb3 100755
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -1140,6 +1140,17 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel)
addChild( btn, 0 );
}
}
+ else
+ {
+ if (textbox)
+ {
+ LLUICtrl::addChild(textbox, 0);
+ }
+ if (btn)
+ {
+ LLUICtrl::addChild(btn, 0);
+ }
+ }
if (child)
{
@@ -1636,16 +1647,26 @@ void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon)
{
LLTabTuple* tuple = getTabByPanel(child);
LLCustomButtonIconCtrl* button;
+ bool hasButton = false;
if(tuple)
{
button = dynamic_cast<LLCustomButtonIconCtrl*>(tuple->mButton);
if(button)
{
+ hasButton = true;
button->setIcon(icon);
reshapeTuple(tuple);
}
}
+
+ if (!hasButton && (icon != NULL))
+ {
+ // It was assumed that the tab's button would take ownership of the icon pointer.
+ // But since the tab did not have a button, kill the icon to prevent the memory
+ // leak.
+ icon->die();
+ }
}
void LLTabContainer::reshapeTuple(LLTabTuple* tuple)
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 62edbadb07..30e6c6248e 100755
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1955,6 +1955,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
// create and return the context menu from the XUI file
delete mPopupMenu;
+ llassert(LLMenuGL::sMenuContainer != NULL);
mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(xui_file, LLMenuGL::sMenuContainer,
LLMenuHolderGL::child_registry_t::instance());
if (mIsFriendSignal)
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index c797b6acc5..b4ebed0849 100755
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -2031,6 +2031,7 @@ void LLTextEditor::showContextMenu(S32 x, S32 y)
{
if (!mContextMenu)
{
+ llassert(LLMenuGL::sMenuContainer != NULL);
mContextMenu = LLUICtrlFactory::instance().createFromFile<LLContextMenu>("menu_text_editor.xml",
LLMenuGL::sMenuContainer,
LLMenuHolderGL::child_registry_t::instance());
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index f9bdd87087..abc2b6e9ca 100755
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -148,6 +148,7 @@ void LLToolBar::createContextMenu()
enable_reg.add("Toolbars.CheckSetting", boost::bind(&LLToolBar::isSettingChecked, this, _2));
// Create the context menu
+ llassert(LLMenuGL::sMenuContainer != NULL);
LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile<LLContextMenu>("menu_toolbars.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
if (menu)
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 0637572f67..19961d5759 100755
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -657,7 +657,7 @@ LLWindowWin32::~LLWindowWin32()
delete [] mSupportedResolutions;
mSupportedResolutions = NULL;
- delete mWindowClassName;
+ delete [] mWindowClassName;
mWindowClassName = NULL;
}
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index f98ec69732..f52e6625c1 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2019,6 +2019,9 @@ bool LLAppViewer::cleanup()
// Non-LLCurl libcurl library
mAppCoreHttp.cleanup();
+ // NOTE The following call is not thread safe.
+ ll_cleanup_ares();
+
LLFilePickerThread::cleanupClass();
//MUST happen AFTER LLCurl::cleanupClass
@@ -2114,6 +2117,8 @@ bool LLAppViewer::cleanup()
ll_close_fail_log();
+ LLError::LLCallStacks::cleanup();
+
removeMarkerFiles();
LL_INFOS() << "Goodbye!" << LL_ENDL;
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 06f081e920..57fb84bbf1 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -438,7 +438,7 @@ void LLAppViewerWin32::disableWinErrorReporting()
const S32 MAX_CONSOLE_LINES = 500;
-void create_console()
+static bool create_console()
{
int h_con_handle;
long l_std_handle;
@@ -447,7 +447,7 @@ void create_console()
FILE *fp;
// allocate a console for this app
- AllocConsole();
+ const bool isConsoleAllocated = AllocConsole();
// set the screen buffer to be big enough to let us scroll text
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo);
@@ -495,10 +495,13 @@ void create_console()
*stderr = *fp;
setvbuf( stderr, NULL, _IONBF, 0 );
}
+
+ return isConsoleAllocated;
}
LLAppViewerWin32::LLAppViewerWin32(const char* cmd_line) :
- mCmdLine(cmd_line)
+ mCmdLine(cmd_line),
+ mIsConsoleAllocated(false)
{
}
@@ -542,6 +545,16 @@ bool LLAppViewerWin32::cleanup()
gDXHardware.cleanup();
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+ LLWinDebug::instance().cleanup();
+#endif
+
+ if (mIsConsoleAllocated)
+ {
+ FreeConsole();
+ mIsConsoleAllocated = false;
+ }
+
return result;
}
@@ -553,7 +566,7 @@ void LLAppViewerWin32::initLoggingAndGetLastDuration()
void LLAppViewerWin32::initConsole()
{
// pop up debug console
- create_console();
+ mIsConsoleAllocated = create_console();
return LLAppViewer::initConsole();
}
diff --git a/indra/newview/llappviewerwin32.h b/indra/newview/llappviewerwin32.h
index fb37df1a2f..59d1ddaa3d 100644
--- a/indra/newview/llappviewerwin32.h
+++ b/indra/newview/llappviewerwin32.h
@@ -61,7 +61,8 @@ protected:
private:
void disableWinErrorReporting();
- std::string mCmdLine;
+ std::string mCmdLine;
+ bool mIsConsoleAllocated;
};
#endif // LL_LLAPPVIEWERWIN32_H
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 05c4181714..84b9ac756a 100755
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -107,6 +107,7 @@ class LLChatHistoryHeader: public LLPanel
public:
LLChatHistoryHeader()
: LLPanel(),
+ mInfoCtrl(NULL),
mPopupMenuHandleAvatar(),
mPopupMenuHandleObject(),
mAvatarID(),
@@ -129,9 +130,6 @@ public:
~LLChatHistoryHeader()
{
- // Detach the info button so that it doesn't get destroyed (EXT-8463).
- hideInfoCtrl();
-
if (mAvatarNameCacheConnection.connected())
{
mAvatarNameCacheConnection.disconnect();
@@ -292,6 +290,11 @@ public:
mUserNameTextBox = getChild<LLTextBox>("user_name");
mTimeBoxTextBox = getChild<LLTextBox>("time_box");
+ mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile<LLUICtrl>("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance());
+ llassert(mInfoCtrl != NULL);
+ mInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, mInfoCtrl));
+ mInfoCtrl->setVisible(FALSE);
+
return LLPanel::postBuild();
}
@@ -589,39 +592,19 @@ protected:
void showInfoCtrl()
{
- if (mAvatarID.isNull() || mFrom.empty() || CHAT_SOURCE_SYSTEM == mSourceType) return;
-
- if (!sInfoCtrl)
- {
- // *TODO: Delete the button at exit.
- sInfoCtrl = LLUICtrlFactory::createFromFile<LLUICtrl>("inspector_info_ctrl.xml", NULL, LLPanel::child_registry_t::instance());
- if (sInfoCtrl)
- {
- sInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, sInfoCtrl));
- }
- }
-
- if (!sInfoCtrl)
+ const bool isVisible = !mAvatarID.isNull() && !mFrom.empty() && CHAT_SOURCE_SYSTEM != mSourceType;
+ if (isVisible)
{
- llassert(sInfoCtrl != NULL);
- return;
+ const LLRect sticky_rect = mUserNameTextBox->getRect();
+ S32 icon_x = llmin(sticky_rect.mLeft + mUserNameTextBox->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3);
+ mInfoCtrl->setOrigin(icon_x, sticky_rect.getCenterY() - mInfoCtrl->getRect().getHeight() / 2 ) ;
}
-
- LLTextBox* name = getChild<LLTextBox>("user_name");
- LLRect sticky_rect = name->getRect();
- S32 icon_x = llmin(sticky_rect.mLeft + name->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3);
- sInfoCtrl->setOrigin(icon_x, sticky_rect.getCenterY() - sInfoCtrl->getRect().getHeight() / 2 ) ;
- addChild(sInfoCtrl);
+ mInfoCtrl->setVisible(isVisible);
}
void hideInfoCtrl()
{
- if (!sInfoCtrl) return;
-
- if (sInfoCtrl->getParent() == this)
- {
- removeChild(sInfoCtrl);
- }
+ mInfoCtrl->setVisible(FALSE);
}
private:
@@ -692,7 +675,7 @@ protected:
LLHandle<LLView> mPopupMenuHandleAvatar;
LLHandle<LLView> mPopupMenuHandleObject;
- static LLUICtrl* sInfoCtrl;
+ LLUICtrl* mInfoCtrl;
LLUUID mAvatarID;
LLSD mObjectData;
@@ -709,8 +692,6 @@ private:
boost::signals2::connection mAvatarNameCacheConnection;
};
-LLUICtrl* LLChatHistoryHeader::sInfoCtrl = NULL;
-
LLChatHistory::LLChatHistory(const LLChatHistory::Params& p)
: LLUICtrl(p),
mMessageHeaderFilename(p.message_header),
diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h
index bb6d4fb59c..44736a0489 100755
--- a/indra/newview/llchathistory.h
+++ b/indra/newview/llchathistory.h
@@ -93,14 +93,15 @@ class LLChatHistory : public LLUICtrl
* @return pointer to LLView separator object.
*/
LLView* getSeparator();
+
+ void onClickMoreText();
+
+ private:
/**
* Builds a message header.
* @return pointer to LLView header object.
*/
LLView* getHeader(const LLChat& chat,const LLStyle::Params& style_params, const LLSD& args);
-
- void onClickMoreText();
-
public:
~LLChatHistory();
LLSD getValue() const;
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index b1dce42dfd..c0823182c0 100755
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -204,6 +204,7 @@ void LLNotificationChiclet::createMenu()
enable_registrar.add("NotificationWellChicletMenu.EnableItem",
boost::bind(&LLNotificationChiclet::enableMenuItem, this, _2));
+ llassert(LLMenuGL::sMenuContainer != NULL);
mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>
("menu_notification_well_button.xml",
LLMenuGL::sMenuContainer,
diff --git a/indra/newview/lllistcontextmenu.cpp b/indra/newview/lllistcontextmenu.cpp
index a624c9fb87..6bda8b1d0d 100755
--- a/indra/newview/lllistcontextmenu.cpp
+++ b/indra/newview/lllistcontextmenu.cpp
@@ -110,6 +110,7 @@ void LLListContextMenu::handleMultiple(functor_t functor, const uuid_vec_t& ids)
// static
LLContextMenu* LLListContextMenu::createFromFile(const std::string& filename)
{
+ llassert(LLMenuGL::sMenuContainer != NULL);
return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
filename, LLContextMenu::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
}
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 323445afa6..c4b68bb7e1 100755
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -390,8 +390,12 @@ BOOL LLMediaCtrl::postBuild ()
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar;
registar.add("Open.WebInspector", boost::bind(&LLMediaCtrl::onOpenWebInspector, this));
+ // stinson 05/05/2014 : use this as the parent of the context menu if the static menu
+ // container has yet to be created
+ LLPanel* menuParent = (LLMenuGL::sMenuContainer != NULL) ? dynamic_cast<LLPanel*>(LLMenuGL::sMenuContainer) : dynamic_cast<LLPanel*>(this);
+ llassert(menuParent != NULL);
mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
- "menu_media_ctrl.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
+ "menu_media_ctrl.xml", menuParent, LLViewerMenuHolderGL::child_registry_t::instance());
setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChanged, this, _2));
return TRUE;
@@ -1117,3 +1121,8 @@ void LLMediaCtrl::setTrustedContent(bool trusted)
mMediaSource->setTrustedBrowser(trusted);
}
}
+
+void LLMediaCtrl::updateContextMenuParent(LLView* pNewParent)
+{
+ mContextMenu->updateParent(pNewParent);
+}
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index 5978a7a344..b07eb356ae 100755
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -168,6 +168,8 @@ public:
LLUUID getTextureID() {return mMediaTextureID;}
+ void updateContextMenuParent(LLView* pNewParent);
+
protected:
void convertInputCoords(S32& x, S32& y);
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index e48aa88937..158038c4f7 100755
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -159,6 +159,7 @@ public:
registrar.add("Wearable.Create", boost::bind(onCreate, _2));
+ llassert(LLMenuGL::sMenuContainer != NULL);
LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
"menu_cof_gear.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
llassert(menu);
@@ -228,6 +229,7 @@ public:
enable_registrar.add("AddWearable.Gear.Check", boost::bind(onCheck, flat_list_handle, inventory_panel_handle, _2));
enable_registrar.add("AddWearable.Gear.Visible", boost::bind(onVisible, inventory_panel_handle, _2));
+ llassert(LLMenuGL::sMenuContainer != NULL);
LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
"menu_add_wearable_gear.xml",
LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 8fddd9523f..652d2be6f6 100755
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -341,6 +341,7 @@ LLContextMenu* LLTeleportHistoryPanel::ContextMenu::createMenu()
registrar.add("TeleportHistory.CopyToClipboard",boost::bind(&LLTeleportHistoryPanel::ContextMenu::onCopyToClipboard, this));
// create the context menu from the XUI
+ llassert(LLMenuGL::sMenuContainer != NULL);
return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
"menu_teleport_history_item.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
}
@@ -935,6 +936,7 @@ void LLTeleportHistoryPanel::onAccordionTabRightClick(LLView *view, S32 x, S32 y
registrar.add("TeleportHistory.TabClose", boost::bind(&LLTeleportHistoryPanel::onAccordionTabClose, this, tab));
// create the context menu from the XUI
+ llassert(LLMenuGL::sMenuContainer != NULL);
mAccordionTabMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
"menu_teleport_history_tab.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index 6a840f3f40..8708fb87ee 100755
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -273,6 +273,14 @@ void LLScreenChannel::addToast(const LLToast::Params& p)
// only cancel notification if it isn't being used in IM session
LLNotifications::instance().cancel(notification);
}
+
+ // It was assumed that the toast would take ownership of the panel pointer.
+ // But since we have decided not to display the toast, kill the panel to
+ // prevent the memory leak.
+ if (p.panel != NULL)
+ {
+ p.panel()->die();
+ }
return;
}
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index a7b99a0f6b..08a4d00d0f 100755
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -640,12 +640,26 @@ class LLVolumeGeometryManager: public LLGeometryManager
DISTANCE_SORT
} eSortType;
- virtual ~LLVolumeGeometryManager() { }
+ LLVolumeGeometryManager();
+ virtual ~LLVolumeGeometryManager();
virtual void rebuildGeom(LLSpatialGroup* group);
virtual void rebuildMesh(LLSpatialGroup* group);
virtual void getGeometry(LLSpatialGroup* group);
void genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort = FALSE, BOOL batch_textures = FALSE, BOOL no_materials = FALSE);
void registerFace(LLSpatialGroup* group, LLFace* facep, U32 type);
+
+private:
+ void allocateFaces(U32 pMaxFaceCount);
+ void freeFaces();
+
+ static int32_t sInstanceCount;
+ static LLFace** sFullbrightFaces;
+ static LLFace** sBumpFaces;
+ static LLFace** sSimpleFaces;
+ static LLFace** sNormFaces;
+ static LLFace** sSpecFaces;
+ static LLFace** sNormSpecFaces;
+ static LLFace** sAlphaFaces;
};
//spatial partition that uses volume geometry manager (implemented in LLVOVolume.cpp)
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index a4e3c8cdbd..afa2bb6728 100755
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1599,6 +1599,11 @@ void LLViewerMedia::cleanupClass()
{
gIdleCallbacks.deleteFunction(LLViewerMedia::updateMedia, NULL);
sTeleportFinishConnection.disconnect();
+ if (sSpareBrowserMediaSource != NULL)
+ {
+ delete sSpareBrowserMediaSource;
+ sSpareBrowserMediaSource = NULL;
+ }
}
//////////////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 9d2a4a50e1..dafe2cafec 100755
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -355,6 +355,16 @@ LLViewerShaderMgr * LLViewerShaderMgr::instance()
return static_cast<LLViewerShaderMgr*>(sInstance);
}
+// static
+void LLViewerShaderMgr::releaseInstance()
+{
+ if (sInstance != NULL)
+ {
+ delete sInstance;
+ sInstance = NULL;
+ }
+}
+
void LLViewerShaderMgr::initAttribsAndUniforms(void)
{
if (mReservedAttribs.empty())
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index 42147fdd29..923aa522ad 100755
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -43,6 +43,7 @@ public:
// singleton pattern implementation
static LLViewerShaderMgr * instance();
+ static void releaseInstance();
void initAttribsAndUniforms(void);
void setShaders();
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index ec794e527d..fc5fb39f4e 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -261,7 +261,7 @@ std::string LLViewerWindow::sMovieBaseName;
LLTrace::SampleStatHandle<> LLViewerWindow::sMouseVelocityStat("Mouse Velocity");
-class RecordToChatConsole : public LLError::Recorder, public LLSingleton<RecordToChatConsole>
+class RecordToChatConsoleRecorder : public LLError::Recorder
{
public:
virtual void recordMessage(LLError::ELevel level,
@@ -285,6 +285,22 @@ public:
}
};
+class RecordToChatConsole : public LLSingleton<RecordToChatConsole>
+{
+public:
+ RecordToChatConsole()
+ : LLSingleton<RecordToChatConsole>(),
+ mRecorder(new RecordToChatConsoleRecorder())
+ {
+ }
+
+ void startRecorder() { LLError::addRecorder(mRecorder); }
+ void stopRecorder() { LLError::removeRecorder(mRecorder); }
+
+private:
+ LLError::RecorderPtr mRecorder;
+};
+
////////////////////////////////////////////////////////////////////////////
//
// LLDebugText
@@ -1886,11 +1902,11 @@ void LLViewerWindow::initBase()
// optionally forward warnings to chat console/chat floater
// for qa runs and dev builds
#if !LL_RELEASE_FOR_DOWNLOAD
- LLError::addRecorder(RecordToChatConsole::getInstance());
+ RecordToChatConsole::getInstance()->startRecorder();
#else
if(gSavedSettings.getBOOL("QAMode"))
{
- LLError::addRecorder(RecordToChatConsole::getInstance());
+ RecordToChatConsole::getInstance()->startRecorder();
}
#endif
@@ -1907,9 +1923,7 @@ void LLViewerWindow::initBase()
setProgressCancelButtonVisible(FALSE);
gMenuHolder = getRootView()->getChild<LLViewerMenuHolderGL>("Menu Holder");
-
LLMenuGL::sMenuContainer = gMenuHolder;
-
}
void LLViewerWindow::initWorldUI()
@@ -2039,8 +2053,7 @@ void LLViewerWindow::initWorldUI()
void LLViewerWindow::shutdownViews()
{
// clean up warning logger
- LLError::removeRecorder(RecordToChatConsole::getInstance());
-
+ RecordToChatConsole::getInstance()->stopRecorder();
LL_INFOS() << "Warning logger is cleaned." << LL_ENDL ;
delete mDebugText;
@@ -2150,6 +2163,12 @@ LLViewerWindow::~LLViewerWindow()
delete mDebugText;
mDebugText = NULL;
+
+ if (LLViewerShaderMgr::sInitialized)
+ {
+ LLViewerShaderMgr::releaseInstance();
+ LLViewerShaderMgr::sInitialized = FALSE;
+ }
}
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index d1108020ff..1fa14cf003 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4059,7 +4059,8 @@ U32 LLVOVolume::getPartitionType() const
}
LLVolumePartition::LLVolumePartition(LLViewerRegion* regionp)
-: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW_ARB, regionp)
+: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW_ARB, regionp),
+LLVolumeGeometryManager()
{
mLODPeriod = 32;
mDepthMask = FALSE;
@@ -4070,7 +4071,8 @@ LLVolumePartition::LLVolumePartition(LLViewerRegion* regionp)
}
LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep, LLViewerRegion* regionp)
-: LLSpatialBridge(drawablep, TRUE, LLVOVolume::VERTEX_DATA_MASK, regionp)
+: LLSpatialBridge(drawablep, TRUE, LLVOVolume::VERTEX_DATA_MASK, regionp),
+LLVolumeGeometryManager()
{
mDepthMask = FALSE;
mLODPeriod = 32;
@@ -4107,6 +4109,70 @@ bool can_batch_texture(LLFace* facep)
return true;
}
+const static U32 MAX_FACE_COUNT = 4096U;
+int32_t LLVolumeGeometryManager::sInstanceCount = 0;
+LLFace** LLVolumeGeometryManager::sFullbrightFaces = NULL;
+LLFace** LLVolumeGeometryManager::sBumpFaces = NULL;
+LLFace** LLVolumeGeometryManager::sSimpleFaces = NULL;
+LLFace** LLVolumeGeometryManager::sNormFaces = NULL;
+LLFace** LLVolumeGeometryManager::sSpecFaces = NULL;
+LLFace** LLVolumeGeometryManager::sNormSpecFaces = NULL;
+LLFace** LLVolumeGeometryManager::sAlphaFaces = NULL;
+
+LLVolumeGeometryManager::LLVolumeGeometryManager()
+ : LLGeometryManager()
+{
+ llassert(sInstanceCount >= 0);
+ if (sInstanceCount == 0)
+ {
+ allocateFaces(MAX_FACE_COUNT);
+ }
+
+ ++sInstanceCount;
+}
+
+LLVolumeGeometryManager::~LLVolumeGeometryManager()
+{
+ llassert(sInstanceCount > 0);
+ --sInstanceCount;
+
+ if (sInstanceCount <= 0)
+ {
+ freeFaces();
+ sInstanceCount = 0;
+ }
+}
+
+void LLVolumeGeometryManager::allocateFaces(U32 pMaxFaceCount)
+{
+ sFullbrightFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
+ sBumpFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
+ sSimpleFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
+ sNormFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
+ sSpecFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
+ sNormSpecFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
+ sAlphaFaces = static_cast<LLFace**>(ll_aligned_malloc<64>(pMaxFaceCount*sizeof(LLFace*)));
+}
+
+void LLVolumeGeometryManager::freeFaces()
+{
+ ll_aligned_free<64>(sFullbrightFaces);
+ ll_aligned_free<64>(sBumpFaces);
+ ll_aligned_free<64>(sSimpleFaces);
+ ll_aligned_free<64>(sNormFaces);
+ ll_aligned_free<64>(sSpecFaces);
+ ll_aligned_free<64>(sNormSpecFaces);
+ ll_aligned_free<64>(sAlphaFaces);
+
+ sFullbrightFaces = NULL;
+ sBumpFaces = NULL;
+ sSimpleFaces = NULL;
+ sNormFaces = NULL;
+ sSpecFaces = NULL;
+ sNormSpecFaces = NULL;
+ sAlphaFaces = NULL;
+}
+
static LLTrace::BlockTimerStatHandle FTM_REGISTER_FACE("Register Face");
void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 type)
@@ -4429,16 +4495,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
mFaceList.clear();
- const U32 MAX_FACE_COUNT = 4096;
-
- static LLFace** fullbright_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*));
- static LLFace** bump_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*));
- static LLFace** simple_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*));
- static LLFace** norm_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*));
- static LLFace** spec_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*));
- static LLFace** normspec_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*));
- static LLFace** alpha_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*));
-
U32 fullbright_count = 0;
U32 bump_count = 0;
U32 simple_count = 0;
@@ -4820,7 +4876,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //can be treated as alpha mask
if (simple_count < MAX_FACE_COUNT)
{
- simple_faces[simple_count++] = facep;
+ sSimpleFaces[simple_count++] = facep;
}
}
else
@@ -4831,7 +4887,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
}
if (alpha_count < MAX_FACE_COUNT)
{
- alpha_faces[alpha_count++] = facep;
+ sAlphaFaces[alpha_count++] = facep;
}
}
}
@@ -4854,14 +4910,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //has normal and specular maps (needs texcoord1, texcoord2, and tangent)
if (normspec_count < MAX_FACE_COUNT)
{
- normspec_faces[normspec_count++] = facep;
+ sNormSpecFaces[normspec_count++] = facep;
}
}
else
{ //has normal map (needs texcoord1 and tangent)
if (norm_count < MAX_FACE_COUNT)
{
- norm_faces[norm_count++] = facep;
+ sNormFaces[norm_count++] = facep;
}
}
}
@@ -4869,14 +4925,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //has specular map but no normal map, needs texcoord2
if (spec_count < MAX_FACE_COUNT)
{
- spec_faces[spec_count++] = facep;
+ sSpecFaces[spec_count++] = facep;
}
}
else
{ //has neither specular map nor normal map, only needs texcoord0
if (simple_count < MAX_FACE_COUNT)
{
- simple_faces[simple_count++] = facep;
+ sSimpleFaces[simple_count++] = facep;
}
}
}
@@ -4884,14 +4940,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //needs normal + tangent
if (bump_count < MAX_FACE_COUNT)
{
- bump_faces[bump_count++] = facep;
+ sBumpFaces[bump_count++] = facep;
}
}
else if (te->getShiny() || !te->getFullbright())
{ //needs normal
if (simple_count < MAX_FACE_COUNT)
{
- simple_faces[simple_count++] = facep;
+ sSimpleFaces[simple_count++] = facep;
}
}
else
@@ -4899,7 +4955,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
facep->setState(LLFace::FULLBRIGHT);
if (fullbright_count < MAX_FACE_COUNT)
{
- fullbright_faces[fullbright_count++] = facep;
+ sFullbrightFaces[fullbright_count++] = facep;
}
}
}
@@ -4909,7 +4965,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //needs normal + tangent
if (bump_count < MAX_FACE_COUNT)
{
- bump_faces[bump_count++] = facep;
+ sBumpFaces[bump_count++] = facep;
}
}
else if ((te->getShiny() && LLPipeline::sRenderBump) ||
@@ -4917,7 +4973,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{ //needs normal
if (simple_count < MAX_FACE_COUNT)
{
- simple_faces[simple_count++] = facep;
+ sSimpleFaces[simple_count++] = facep;
}
}
else
@@ -4925,7 +4981,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
facep->setState(LLFace::FULLBRIGHT);
if (fullbright_count < MAX_FACE_COUNT)
{
- fullbright_faces[fullbright_count++] = facep;
+ sFullbrightFaces[fullbright_count++] = facep;
}
}
}
@@ -4988,13 +5044,13 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
fullbright_mask = fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX;
}
- genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, simple_faces, simple_count, FALSE, batch_textures, FALSE);
- genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, fullbright_faces, fullbright_count, FALSE, batch_textures);
- genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, alpha_faces, alpha_count, TRUE, batch_textures);
- genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, bump_faces, bump_count, FALSE, FALSE);
- genDrawInfo(group, norm_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, norm_faces, norm_count, FALSE, FALSE);
- genDrawInfo(group, spec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, spec_faces, spec_count, FALSE, FALSE);
- genDrawInfo(group, normspec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, normspec_faces, normspec_count, FALSE, FALSE);
+ genDrawInfo(group, simple_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sSimpleFaces, simple_count, FALSE, batch_textures, FALSE);
+ genDrawInfo(group, fullbright_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sFullbrightFaces, fullbright_count, FALSE, batch_textures);
+ genDrawInfo(group, alpha_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sAlphaFaces, alpha_count, TRUE, batch_textures);
+ genDrawInfo(group, bump_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sBumpFaces, bump_count, FALSE, FALSE);
+ genDrawInfo(group, norm_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sNormFaces, norm_count, FALSE, FALSE);
+ genDrawInfo(group, spec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sSpecFaces, spec_count, FALSE, FALSE);
+ genDrawInfo(group, normspec_mask | LLVertexBuffer::MAP_TEXTURE_INDEX, sNormSpecFaces, normspec_count, FALSE, FALSE);
if (!LLPipeline::sDelayVBUpdate)
{
diff --git a/indra/newview/llwindebug.cpp b/indra/newview/llwindebug.cpp
index 551d0be8d7..eff70ca0b2 100755
--- a/indra/newview/llwindebug.cpp
+++ b/indra/newview/llwindebug.cpp
@@ -45,7 +45,7 @@ public:
~LLMemoryReserve();
void reserve();
void release();
-protected:
+private:
unsigned char *mReserve;
static const size_t MEMORY_RESERVATION_SIZE;
};
@@ -53,7 +53,7 @@ protected:
LLMemoryReserve::LLMemoryReserve() :
mReserve(NULL)
{
-};
+}
LLMemoryReserve::~LLMemoryReserve()
{
@@ -66,14 +66,19 @@ const size_t LLMemoryReserve::MEMORY_RESERVATION_SIZE = 5 * 1024 * 1024;
void LLMemoryReserve::reserve()
{
if(NULL == mReserve)
+ {
mReserve = new unsigned char[MEMORY_RESERVATION_SIZE];
-};
+ }
+}
void LLMemoryReserve::release()
{
- delete [] mReserve;
+ if (NULL != mReserve)
+ {
+ delete [] mReserve;
+ }
mReserve = NULL;
-};
+}
static LLMemoryReserve gEmergencyMemoryReserve;
@@ -130,6 +135,11 @@ void LLWinDebug::init()
}
}
+void LLWinDebug::cleanup ()
+{
+ gEmergencyMemoryReserve.release();
+}
+
void LLWinDebug::writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename)
{
// Temporary fix to switch out the code that writes the DMP file.
diff --git a/indra/newview/llwindebug.h b/indra/newview/llwindebug.h
index 6f274c6f16..a3cbf6dc03 100755
--- a/indra/newview/llwindebug.h
+++ b/indra/newview/llwindebug.h
@@ -37,6 +37,7 @@ class LLWinDebug:
public:
static void init();
static void generateMinidump(struct _EXCEPTION_POINTERS *pExceptionInfo = NULL);
+ static void cleanup();
private:
static void writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename);
};
diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 10f71a2843..e42374d56b 100755
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -95,25 +95,20 @@ public:
virtual void replay(std::ostream&) {}
};
-class LLReplayLogReal: public LLReplayLog, public LLError::Recorder, public boost::noncopyable
+class RecordToTempFile : public LLError::Recorder, public boost::noncopyable
{
public:
- LLReplayLogReal(LLError::ELevel level, apr_pool_t* pool):
- mOldSettings(LLError::saveAndResetSettings()),
- mProxy(new RecorderProxy(this)),
- mTempFile("log", "", pool), // create file
- mFile(mTempFile.getName().c_str()) // open it
+ RecordToTempFile(apr_pool_t* pPool)
+ : LLError::Recorder(),
+ boost::noncopyable(),
+ mTempFile("log", "", pPool),
+ mFile(mTempFile.getName().c_str())
{
- LLError::setFatalFunction(wouldHaveCrashed);
- LLError::setDefaultLevel(level);
- LLError::addRecorder(mProxy);
}
- virtual ~LLReplayLogReal()
+ virtual ~RecordToTempFile()
{
- LLError::removeRecorder(mProxy);
- delete mProxy;
- LLError::restoreSettings(mOldSettings);
+ mFile.close();
}
virtual void recordMessage(LLError::ELevel level, const std::string& message)
@@ -121,13 +116,13 @@ public:
mFile << message << std::endl;
}
- virtual void reset()
+ void reset()
{
mFile.close();
mFile.open(mTempFile.getName().c_str());
}
- virtual void replay(std::ostream& out)
+ void replay(std::ostream& out)
{
mFile.close();
std::ifstream inf(mTempFile.getName().c_str());
@@ -139,12 +134,45 @@ public:
}
private:
- LLError::Settings* mOldSettings;
- LLError::Recorder* mProxy;
NamedTempFile mTempFile;
std::ofstream mFile;
};
+class LLReplayLogReal: public LLReplayLog, public boost::noncopyable
+{
+public:
+ LLReplayLogReal(LLError::ELevel level, apr_pool_t* pool)
+ : LLReplayLog(),
+ boost::noncopyable(),
+ mOldSettings(LLError::saveAndResetSettings()),
+ mRecorder(new RecordToTempFile(pool))
+ {
+ LLError::setFatalFunction(wouldHaveCrashed);
+ LLError::setDefaultLevel(level);
+ LLError::addRecorder(mRecorder);
+ }
+
+ virtual ~LLReplayLogReal()
+ {
+ LLError::removeRecorder(mRecorder);
+ LLError::restoreSettings(mOldSettings);
+ }
+
+ virtual void reset()
+ {
+ boost::dynamic_pointer_cast<RecordToTempFile>(mRecorder)->reset();
+ }
+
+ virtual void replay(std::ostream& out)
+ {
+ boost::dynamic_pointer_cast<RecordToTempFile>(mRecorder)->replay(out);
+ }
+
+private:
+ LLError::SettingsStoragePtr mOldSettings;
+ LLError::RecorderPtr mRecorder;
+};
+
class LLTestCallback : public tut::callback
{
public: