Skip to content
Snippets Groups Projects
Commit 66d97849 authored by Merov Linden's avatar Merov Linden
Browse files

EXP-1353 : Fix crashes when teleport by making the teleport history less naive about its past state

parent 67a61877
No related branches found
No related tags found
No related merge requests found
...@@ -679,29 +679,32 @@ void LLTeleportHistoryPanel::refresh() ...@@ -679,29 +679,32 @@ void LLTeleportHistoryPanel::refresh()
// tab_boundary_date would be earliest possible date for this tab // tab_boundary_date would be earliest possible date for this tab
S32 tab_idx = 0; S32 tab_idx = 0;
getNextTab(date, tab_idx, tab_boundary_date); getNextTab(date, tab_idx, tab_boundary_date);
tab_idx = mItemContainers.size() - 1 - tab_idx;
LLAccordionCtrlTab* tab = mItemContainers.get(mItemContainers.size() - 1 - tab_idx); if (tab_idx >= 0)
tab->setVisible(true);
// Expand all accordion tabs when filtering
if(!sFilterSubString.empty())
{ {
//store accordion tab state when filter is not empty LLAccordionCtrlTab* tab = mItemContainers.get(tab_idx);
tab->notifyChildren(LLSD().with("action","store_state")); tab->setVisible(true);
tab->setDisplayChildren(true); // Expand all accordion tabs when filtering
} if(!sFilterSubString.empty())
// Restore each tab's expand state when not filtering {
else //store accordion tab state when filter is not empty
{ tab->notifyChildren(LLSD().with("action","store_state"));
bool collapsed = isAccordionCollapsedByUser(tab);
tab->setDisplayChildren(!collapsed);
//restore accordion state after all those accodrion tabmanipulations tab->setDisplayChildren(true);
tab->notifyChildren(LLSD().with("action","restore_state")); }
} // 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) if (curr_flat_view)
...@@ -760,7 +763,12 @@ void LLTeleportHistoryPanel::onTeleportHistoryChange(S32 removed_index) ...@@ -760,7 +763,12 @@ void LLTeleportHistoryPanel::onTeleportHistoryChange(S32 removed_index)
void LLTeleportHistoryPanel::replaceItem(S32 removed_index) void LLTeleportHistoryPanel::replaceItem(S32 removed_index)
{ {
// Flat list for 'Today' (mItemContainers keeps accordion tabs in reverse order) // 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, // Empty flat list for 'Today' means that other flat lists are empty as well,
// so all items from teleport history should be added. // so all items from teleport history should be added.
...@@ -828,19 +836,27 @@ void LLTeleportHistoryPanel::showTeleportHistory() ...@@ -828,19 +836,27 @@ void LLTeleportHistoryPanel::showTeleportHistory()
// Starting to add items from last one, in reverse order, // Starting to add items from last one, in reverse order,
// since TeleportHistory keeps most recent item at the end // since TeleportHistory keeps most recent item at the end
if (!mTeleportHistory)
{
mTeleportHistory = LLTeleportHistoryStorage::getInstance();
}
mCurrentItem = mTeleportHistory->getItems().size() - 1; mCurrentItem = mTeleportHistory->getItems().size() - 1;
for (S32 n = mItemContainers.size() - 1; n >= 0; --n) for (S32 n = mItemContainers.size() - 1; n >= 0; --n)
{ {
LLAccordionCtrlTab* tab = mItemContainers.get(n); LLAccordionCtrlTab* tab = mItemContainers.get(n);
tab->setVisible(false); if (tab)
LLFlatListView* fv = getFlatListViewFromTab(tab);
if (fv)
{ {
// Detached panels are managed by LLTeleportHistoryFlatItemStorage tab->setVisible(false);
std::vector<LLPanel*> detached_items;
fv->detachItems(detached_items); LLFlatListView* fv = getFlatListViewFromTab(tab);
if (fv)
{
// Detached panels are managed by LLTeleportHistoryFlatItemStorage
std::vector<LLPanel*> detached_items;
fv->detachItems(detached_items);
}
} }
} }
} }
......
...@@ -66,6 +66,7 @@ struct LLSortItemsByDate ...@@ -66,6 +66,7 @@ struct LLSortItemsByDate
LLTeleportHistoryStorage::LLTeleportHistoryStorage() : LLTeleportHistoryStorage::LLTeleportHistoryStorage() :
mFilename("teleport_history.txt") mFilename("teleport_history.txt")
{ {
mItems.clear();
LLTeleportHistory *th = LLTeleportHistory::getInstance(); LLTeleportHistory *th = LLTeleportHistory::getInstance();
if (th) if (th)
th->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryStorage::onTeleportHistoryChange, this)); th->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryStorage::onTeleportHistoryChange, this));
......
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