Skip to content
Snippets Groups Projects
Commit fe253e6e authored by Xiaohong Bao's avatar Xiaohong Bao
Browse files

merge the changeset 4de3178c6c81 from viewer-development: fixed the major...

merge the changeset 4de3178c6c81 from viewer-development: fixed the major memory leaking for SH-723/SH-847: memoy leaking
parent 403b509f
No related branches found
No related tags found
No related merge requests found
...@@ -41,35 +41,36 @@ ...@@ -41,35 +41,36 @@
// static // static
std::set<std::string> LLFirstUse::sConfigVariables; //std::set<std::string> LLFirstUse::sConfigVariables;
std::set<std::string> LLFirstUse::sConfigVariablesEnabled;
// static // static
void LLFirstUse::addConfigVariable(const std::string& var) //void LLFirstUse::addConfigVariable(const std::string& var)
{ //{
sConfigVariables.insert(var); // sConfigVariables.insert(var);
} //}
// static // static
void LLFirstUse::disableFirstUse() //void LLFirstUse::disableFirstUse()
{ //{
// Set all first-use warnings to disabled // // Set all first-use warnings to disabled
for (std::set<std::string>::iterator iter = sConfigVariables.begin(); // for (std::set<std::string>::iterator iter = sConfigVariables.begin();
iter != sConfigVariables.end(); ++iter) // iter != sConfigVariables.end(); ++iter)
{ // {
gWarningSettings.setBOOL(*iter, FALSE); // gWarningSettings.setBOOL(*iter, FALSE);
} // }
} //}
// static // static
void LLFirstUse::resetFirstUse() //void LLFirstUse::resetFirstUse()
{ //{
// Set all first-use warnings to disabled // // Set all first-use warnings to disabled
for (std::set<std::string>::iterator iter = sConfigVariables.begin(); // for (std::set<std::string>::iterator iter = sConfigVariables.begin();
iter != sConfigVariables.end(); ++iter) // iter != sConfigVariables.end(); ++iter)
{ // {
gWarningSettings.setBOOL(*iter, TRUE); // gWarningSettings.setBOOL(*iter, TRUE);
} // }
} //}
// static // static
void LLFirstUse::otherAvatarChatFirst(bool enable) void LLFirstUse::otherAvatarChatFirst(bool enable)
...@@ -151,13 +152,21 @@ void LLFirstUse::firstUseNotification(const std::string& control_var, bool enabl ...@@ -151,13 +152,21 @@ void LLFirstUse::firstUseNotification(const std::string& control_var, bool enabl
if (enable) if (enable)
{ {
if(sConfigVariablesEnabled.find(control_var) != sConfigVariablesEnabled.end())
{
return ; //already added
}
if (gSavedSettings.getBOOL("EnableUIHints")) if (gSavedSettings.getBOOL("EnableUIHints"))
{ {
LL_DEBUGS("LLFirstUse") << "Trigger first use notification " << notification_name << LL_ENDL; LL_DEBUGS("LLFirstUse") << "Trigger first use notification " << notification_name << LL_ENDL;
// if notification doesn't already exist and this notification hasn't been disabled... // if notification doesn't already exist and this notification hasn't been disabled...
if (gWarningSettings.getBOOL(control_var)) if (gWarningSettings.getBOOL(control_var))
{ // create new notification {
sConfigVariablesEnabled.insert(control_var) ;
// create new notification
LLNotifications::instance().add(LLNotification::Params().name(notification_name).substitutions(args).payload(payload.with("control_var", control_var))); LLNotifications::instance().add(LLNotification::Params().name(notification_name).substitutions(args).payload(payload.with("control_var", control_var)));
} }
} }
...@@ -169,7 +178,6 @@ void LLFirstUse::firstUseNotification(const std::string& control_var, bool enabl ...@@ -169,7 +178,6 @@ void LLFirstUse::firstUseNotification(const std::string& control_var, bool enabl
// redundantly clear settings var here, in case there are no notifications to cancel // redundantly clear settings var here, in case there are no notifications to cancel
gWarningSettings.setBOOL(control_var, FALSE); gWarningSettings.setBOOL(control_var, FALSE);
} }
} }
// static // static
......
...@@ -78,11 +78,11 @@ class LLFirstUse ...@@ -78,11 +78,11 @@ class LLFirstUse
public: public:
// Add a config variable to be reset on resetFirstUse() // Add a config variable to be reset on resetFirstUse()
static void addConfigVariable(const std::string& var); //static void addConfigVariable(const std::string& var);
// Sets all controls back to show the dialogs. // Sets all controls back to show the dialogs.
static void disableFirstUse(); //static void disableFirstUse();
static void resetFirstUse(); //static void resetFirstUse();
static void otherAvatarChatFirst(bool enable = true); static void otherAvatarChatFirst(bool enable = true);
static void sit(bool enable = true); static void sit(bool enable = true);
...@@ -98,7 +98,8 @@ class LLFirstUse ...@@ -98,7 +98,8 @@ class LLFirstUse
protected: protected:
static void firstUseNotification(const std::string& control_var, bool enable, const std::string& notification_name, LLSD args = LLSD(), LLSD payload = LLSD()); static void firstUseNotification(const std::string& control_var, bool enable, const std::string& notification_name, LLSD args = LLSD(), LLSD payload = LLSD());
static std::set<std::string> sConfigVariables; //static std::set<std::string> sConfigVariables;
static std::set<std::string> sConfigVariablesEnabled;
static void init(); static void init();
static bool processNotification(const LLSD& notify); static bool processNotification(const LLSD& notify);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment