diff options
author | McCabe Maxsted | 2010-05-18 14:56:38 -0700 |
---|---|---|
committer | Jacek Antonelli | 2010-06-19 02:40:54 -0500 |
commit | bd35913526ff34dcfaa1a8bfab88138db0abb413 (patch) | |
tree | 53757ab511953317807d7570dba3a8349cf76658 /linden/indra/newview/llfloaterwindlight.cpp | |
parent | Removing camera-behind-agent-head-blocking-view-when-looking-at-last-chatter ... (diff) | |
download | meta-impy-bd35913526ff34dcfaa1a8bfab88138db0abb413.zip meta-impy-bd35913526ff34dcfaa1a8bfab88138db0abb413.tar.gz meta-impy-bd35913526ff34dcfaa1a8bfab88138db0abb413.tar.bz2 meta-impy-bd35913526ff34dcfaa1a8bfab88138db0abb413.tar.xz |
Fixed crash caused by creating new windlight presets with spaces in the name or deleting existing presets
Diffstat (limited to 'linden/indra/newview/llfloaterwindlight.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterwindlight.cpp | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/linden/indra/newview/llfloaterwindlight.cpp b/linden/indra/newview/llfloaterwindlight.cpp index 5468ca4..42adba8 100644 --- a/linden/indra/newview/llfloaterwindlight.cpp +++ b/linden/indra/newview/llfloaterwindlight.cpp | |||
@@ -924,6 +924,14 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS | |||
924 | if(combo_box->getItemCount() > 0) | 924 | if(combo_box->getItemCount() > 0) |
925 | { | 925 | { |
926 | combo_box->setCurrentByIndex(new_index); | 926 | combo_box->setCurrentByIndex(new_index); |
927 | |||
928 | // If we don't update the name here, we crash on next/prev -- MC | ||
929 | LLWLParamManager::instance()->mCurParams.mName = combo_box->getSelectedValue().asString(); | ||
930 | if (LLWLParamManager::instance()->mCurParams.mName.empty()) | ||
931 | { | ||
932 | LLWLParamManager::instance()->mCurParams.mName = "Default"; | ||
933 | } | ||
934 | LLWLParamManager::instance()->loadPreset(LLWLParamManager::instance()->mCurParams.mName, true); | ||
927 | } | 935 | } |
928 | } | 936 | } |
929 | return false; | 937 | return false; |
@@ -1023,50 +1031,58 @@ void LLFloaterWindLight::deactivateAnimator() | |||
1023 | 1031 | ||
1024 | void LLFloaterWindLight::onClickNext(void* user_data) | 1032 | void LLFloaterWindLight::onClickNext(void* user_data) |
1025 | { | 1033 | { |
1026 | LLWLParamManager * param_mgr = LLWLParamManager::instance(); | ||
1027 | LLWLParamSet& currentParams = param_mgr->mCurParams; | ||
1028 | |||
1029 | // find place of current param | 1034 | // find place of current param |
1030 | std::map<std::string, LLWLParamSet>::iterator mIt = | 1035 | std::map<std::string, LLWLParamSet>::iterator mIt = |
1031 | param_mgr->mParamList.find(currentParams.mName); | 1036 | LLWLParamManager::instance()->mParamList.find(LLWLParamManager::instance()->mCurParams.mName); |
1037 | |||
1038 | // shouldn't happen unless you delete every preset but Default | ||
1039 | if (mIt == LLWLParamManager::instance()->mParamList.end()) | ||
1040 | { | ||
1041 | llwarns << "No more presets left!" << llendl; | ||
1042 | return; | ||
1043 | } | ||
1032 | 1044 | ||
1033 | // if at the end, loop | 1045 | // if at the end, loop |
1034 | std::map<std::string, LLWLParamSet>::iterator last = param_mgr->mParamList.end(); --last; | 1046 | std::map<std::string, LLWLParamSet>::iterator last = LLWLParamManager::instance()->mParamList.end(); --last; |
1035 | if(mIt == last) | 1047 | if(mIt == last) |
1036 | { | 1048 | { |
1037 | mIt = param_mgr->mParamList.begin(); | 1049 | mIt = LLWLParamManager::instance()->mParamList.begin(); |
1038 | } | 1050 | } |
1039 | else | 1051 | else |
1040 | { | 1052 | { |
1041 | mIt++; | 1053 | mIt++; |
1042 | } | 1054 | } |
1043 | param_mgr->mAnimator.mIsRunning = false; | 1055 | LLWLParamManager::instance()->mAnimator.mIsRunning = false; |
1044 | param_mgr->mAnimator.mUseLindenTime = false; | 1056 | LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; |
1045 | param_mgr->loadPreset(mIt->first, true); | 1057 | LLWLParamManager::instance()->loadPreset(mIt->first, true); |
1046 | } | 1058 | } |
1047 | 1059 | ||
1048 | void LLFloaterWindLight::onClickPrev(void* user_data) | 1060 | void LLFloaterWindLight::onClickPrev(void* user_data) |
1049 | { | 1061 | { |
1050 | LLWLParamManager * param_mgr = LLWLParamManager::instance(); | ||
1051 | LLWLParamSet& currentParams = param_mgr->mCurParams; | ||
1052 | |||
1053 | // find place of current param | 1062 | // find place of current param |
1054 | std::map<std::string, LLWLParamSet>::iterator mIt = | 1063 | std::map<std::string, LLWLParamSet>::iterator mIt = |
1055 | param_mgr->mParamList.find(currentParams.mName); | 1064 | LLWLParamManager::instance()->mParamList.find(LLWLParamManager::instance()->mCurParams.mName); |
1065 | |||
1066 | // shouldn't happen unless you delete every preset but Default | ||
1067 | if (mIt == LLWLParamManager::instance()->mParamList.end()) | ||
1068 | { | ||
1069 | llwarns << "No more presets left!" << llendl; | ||
1070 | return; | ||
1071 | } | ||
1056 | 1072 | ||
1057 | // if at the beginning, loop | 1073 | // if at the beginning, loop |
1058 | if(mIt == param_mgr->mParamList.begin()) | 1074 | if(mIt == LLWLParamManager::instance()->mParamList.begin()) |
1059 | { | 1075 | { |
1060 | std::map<std::string, LLWLParamSet>::iterator last = param_mgr->mParamList.end(); --last; | 1076 | std::map<std::string, LLWLParamSet>::iterator last = LLWLParamManager::instance()->mParamList.end(); --last; |
1061 | mIt = last; | 1077 | mIt = last; |
1062 | } | 1078 | } |
1063 | else | 1079 | else |
1064 | { | 1080 | { |
1065 | mIt--; | 1081 | mIt--; |
1066 | } | 1082 | } |
1067 | param_mgr->mAnimator.mIsRunning = false; | 1083 | LLWLParamManager::instance()->mAnimator.mIsRunning = false; |
1068 | param_mgr->mAnimator.mUseLindenTime = false; | 1084 | LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; |
1069 | param_mgr->loadPreset(mIt->first, true); | 1085 | LLWLParamManager::instance()->loadPreset(mIt->first, true); |
1070 | } | 1086 | } |
1071 | 1087 | ||
1072 | //static | 1088 | //static |