diff options
| author | Merov Linden <merov@lindenlab.com> | 2011-10-17 17:44:18 -0700 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2011-10-17 17:44:18 -0700 | 
| commit | 66d978497f8169d1a46a5ad8b74c2f72a61941be (patch) | |
| tree | caa76a2a83978e1a1840cd790f5bf56469ace320 | |
| parent | 67a618777286e1d0ce7cfc2a956bf15ff2173005 (diff) | |
EXP-1353 : Fix crashes when teleport by making the teleport history less naive about its past state
| -rw-r--r-- | indra/newview/llpanelteleporthistory.cpp | 72 | ||||
| -rw-r--r-- | indra/newview/llteleporthistorystorage.cpp | 1 | 
2 files changed, 45 insertions, 28 deletions
| diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 79171dbcb9..2c3f76f546 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -679,29 +679,32 @@ void LLTeleportHistoryPanel::refresh()  			// tab_boundary_date would be earliest possible date for this tab  			S32 tab_idx = 0;  			getNextTab(date, tab_idx, tab_boundary_date); - -			LLAccordionCtrlTab* tab = mItemContainers.get(mItemContainers.size() - 1 - tab_idx); -			tab->setVisible(true); - -			// Expand all accordion tabs when filtering -			if(!sFilterSubString.empty()) +			tab_idx = mItemContainers.size() - 1 - tab_idx; +			if (tab_idx >= 0)  			{ -				//store accordion tab state when filter is not empty -				tab->notifyChildren(LLSD().with("action","store_state")); -				 -				tab->setDisplayChildren(true); -			} -			// Restore each tab's expand state when not filtering -			else -			{ -				bool collapsed = isAccordionCollapsedByUser(tab); -				tab->setDisplayChildren(!collapsed); +				LLAccordionCtrlTab* tab = mItemContainers.get(tab_idx); +				tab->setVisible(true); + +				// Expand all accordion tabs when filtering +				if(!sFilterSubString.empty()) +				{ +					//store accordion tab state when filter is not empty +					tab->notifyChildren(LLSD().with("action","store_state")); -				//restore accordion state after all those accodrion tabmanipulations -				tab->notifyChildren(LLSD().with("action","restore_state")); -			} +					tab->setDisplayChildren(true); +				} +				// Restore each tab's expand state when not filtering +				else +				{ +					bool collapsed = isAccordionCollapsedByUser(tab); +					tab->setDisplayChildren(!collapsed); +			 +					//restore accordion state after all those accodrion tabmanipulations +					tab->notifyChildren(LLSD().with("action","restore_state")); +				} -			curr_flat_view = getFlatListViewFromTab(tab); +				curr_flat_view = getFlatListViewFromTab(tab); +			}  		}  		if (curr_flat_view) @@ -760,7 +763,12 @@ void LLTeleportHistoryPanel::onTeleportHistoryChange(S32 removed_index)  void LLTeleportHistoryPanel::replaceItem(S32 removed_index)  {  	// Flat list for 'Today' (mItemContainers keeps accordion tabs in reverse order) -	LLFlatListView* fv = getFlatListViewFromTab(mItemContainers[mItemContainers.size() - 1]); +	LLFlatListView* fv = NULL; +	 +	if (mItemContainers.size() > 0) +	{ +		fv = getFlatListViewFromTab(mItemContainers[mItemContainers.size() - 1]); +	}  	// Empty flat list for 'Today' means that other flat lists are empty as well,  	// so all items from teleport history should be added. @@ -828,19 +836,27 @@ void LLTeleportHistoryPanel::showTeleportHistory()  	// Starting to add items from last one, in reverse order,  	// since TeleportHistory keeps most recent item at the end +	if (!mTeleportHistory) +	{ +		mTeleportHistory = LLTeleportHistoryStorage::getInstance(); +	} +  	mCurrentItem = mTeleportHistory->getItems().size() - 1;  	for (S32 n = mItemContainers.size() - 1; n >= 0; --n)  	{  		LLAccordionCtrlTab* tab = mItemContainers.get(n); -		tab->setVisible(false); - -		LLFlatListView* fv = getFlatListViewFromTab(tab); -		if (fv) +		if (tab)  		{ -			// Detached panels are managed by LLTeleportHistoryFlatItemStorage -			std::vector<LLPanel*> detached_items; -			fv->detachItems(detached_items); +			tab->setVisible(false); + +			LLFlatListView* fv = getFlatListViewFromTab(tab); +			if (fv) +			{ +				// Detached panels are managed by LLTeleportHistoryFlatItemStorage +				std::vector<LLPanel*> detached_items; +				fv->detachItems(detached_items); +			}  		}  	}  } diff --git a/indra/newview/llteleporthistorystorage.cpp b/indra/newview/llteleporthistorystorage.cpp index 0ba455e7d5..af5a047da4 100644 --- a/indra/newview/llteleporthistorystorage.cpp +++ b/indra/newview/llteleporthistorystorage.cpp @@ -66,6 +66,7 @@ struct LLSortItemsByDate  LLTeleportHistoryStorage::LLTeleportHistoryStorage() :  	mFilename("teleport_history.txt")  { +	mItems.clear();  	LLTeleportHistory *th = LLTeleportHistory::getInstance();  	if (th)  		th->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryStorage::onTeleportHistoryChange, this));	 | 
