Skip to content
Snippets Groups Projects
Commit 870fc8b8 authored by Testicular Slingshot's avatar Testicular Slingshot
Browse files

Revert "Potential crash fixes." due to being unnecessary.

This reverts commit 7fc44b35.
parent 394b253c
No related branches found
No related tags found
1 merge request!10Revert "Potential crash fixes." due to being unnecessary.
...@@ -399,7 +399,7 @@ LLScrollListItem* LLScrollListCtrl::getFirstSelected() const ...@@ -399,7 +399,7 @@ LLScrollListItem* LLScrollListCtrl::getFirstSelected() const
for(iter = mItemList.begin(); iter != mItemList.end(); iter++) for(iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter; LLScrollListItem* item = *iter;
if (item && item->getSelected()) if (item->getSelected())
{ {
return item; return item;
} }
...@@ -414,7 +414,7 @@ std::vector<LLScrollListItem*> LLScrollListCtrl::getAllSelected() const ...@@ -414,7 +414,7 @@ std::vector<LLScrollListItem*> LLScrollListCtrl::getAllSelected() const
for(iter = mItemList.begin(); iter != mItemList.end(); iter++) for(iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter; LLScrollListItem* item = *iter;
if (item && item->getSelected()) if (item->getSelected())
{ {
ret.push_back(item); ret.push_back(item);
} }
...@@ -429,7 +429,7 @@ S32 LLScrollListCtrl::getNumSelected() const ...@@ -429,7 +429,7 @@ S32 LLScrollListCtrl::getNumSelected() const
for(item_list::const_iterator iter = mItemList.begin(); iter != mItemList.end(); ++iter) for(item_list::const_iterator iter = mItemList.begin(); iter != mItemList.end(); ++iter)
{ {
LLScrollListItem* item = *iter; LLScrollListItem* item = *iter;
if (item && item->getSelected()) if (item->getSelected())
{ {
++numSelected; ++numSelected;
} }
...@@ -449,7 +449,7 @@ S32 LLScrollListCtrl::getFirstSelectedIndex() const ...@@ -449,7 +449,7 @@ S32 LLScrollListCtrl::getFirstSelectedIndex() const
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter; LLScrollListItem* item = *iter;
if (item && item->getSelected()) if (item->getSelected())
{ {
return CurSelectedIndex; return CurSelectedIndex;
} }
...@@ -499,7 +499,7 @@ LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const ...@@ -499,7 +499,7 @@ LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const
{ {
LLScrollListItem* item = *iter; LLScrollListItem* item = *iter;
// assumes string representation is good enough for comparison // assumes string representation is good enough for comparison
if (item && item->getValue().asString() == string_val) if (item->getValue().asString() == string_val)
{ {
return item; return item;
} }
...@@ -653,7 +653,6 @@ S32 LLScrollListCtrl::calcMaxContentWidth() ...@@ -653,7 +653,6 @@ S32 LLScrollListCtrl::calcMaxContentWidth()
item_list::iterator iter; item_list::iterator iter;
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
if (!(*iter)) continue;
LLScrollListCell* cellp = (*iter)->getColumn(column->mIndex); LLScrollListCell* cellp = (*iter)->getColumn(column->mIndex);
if (!cellp) continue; if (!cellp) continue;
...@@ -793,11 +792,6 @@ void LLScrollListCtrl::updateColumns(bool force_update) ...@@ -793,11 +792,6 @@ void LLScrollListCtrl::updateColumns(bool force_update)
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem *itemp = *iter; LLScrollListItem *itemp = *iter;
if (!itemp)
{
continue;
}
S32 num_cols = itemp->getNumColumns(); S32 num_cols = itemp->getNumColumns();
S32 i = 0; S32 i = 0;
for (LLScrollListCell* cell = itemp->getColumn(i); i < num_cols; cell = itemp->getColumn(++i)) for (LLScrollListCell* cell = itemp->getColumn(i); i < num_cols; cell = itemp->getColumn(++i))
...@@ -835,7 +829,7 @@ BOOL LLScrollListCtrl::selectFirstItem() ...@@ -835,7 +829,7 @@ BOOL LLScrollListCtrl::selectFirstItem()
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem *itemp = *iter; LLScrollListItem *itemp = *iter;
if( first_item && itemp && itemp->getEnabled() ) if( first_item && itemp->getEnabled() )
{ {
if (!itemp->getSelected()) if (!itemp->getSelected())
{ {
...@@ -976,7 +970,7 @@ void LLScrollListCtrl::deleteItems(const LLSD& sd) ...@@ -976,7 +970,7 @@ void LLScrollListCtrl::deleteItems(const LLSD& sd)
for (iter = mItemList.begin(); iter < mItemList.end(); ) for (iter = mItemList.begin(); iter < mItemList.end(); )
{ {
LLScrollListItem* itemp = *iter; LLScrollListItem* itemp = *iter;
if (itemp && itemp->getValue().asString() == sd.asString()) if (itemp->getValue().asString() == sd.asString())
{ {
if (itemp == mLastSelected) if (itemp == mLastSelected)
{ {
...@@ -1000,7 +994,7 @@ void LLScrollListCtrl::deleteSelectedItems() ...@@ -1000,7 +994,7 @@ void LLScrollListCtrl::deleteSelectedItems()
for (iter = mItemList.begin(); iter < mItemList.end(); ) for (iter = mItemList.begin(); iter < mItemList.end(); )
{ {
LLScrollListItem* itemp = *iter; LLScrollListItem* itemp = *iter;
if (itemp && itemp->getSelected()) if (itemp->getSelected())
{ {
delete itemp; delete itemp;
iter = mItemList.erase(iter); iter = mItemList.erase(iter);
...@@ -1084,7 +1078,7 @@ S32 LLScrollListCtrl::getItemIndex( const LLUUID& target_id ) const ...@@ -1084,7 +1078,7 @@ S32 LLScrollListCtrl::getItemIndex( const LLUUID& target_id ) const
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem *itemp = *iter; LLScrollListItem *itemp = *iter;
if (itemp && target_id == itemp->getUUID()) if (target_id == itemp->getUUID())
{ {
return index; return index;
} }
...@@ -1111,7 +1105,7 @@ void LLScrollListCtrl::selectPrevItem( BOOL extend_selection) ...@@ -1111,7 +1105,7 @@ void LLScrollListCtrl::selectPrevItem( BOOL extend_selection)
{ {
LLScrollListItem* cur_item = *iter; LLScrollListItem* cur_item = *iter;
if (cur_item && cur_item->getSelected()) if (cur_item->getSelected())
{ {
if (prev_item) if (prev_item)
{ {
...@@ -1125,7 +1119,7 @@ void LLScrollListCtrl::selectPrevItem( BOOL extend_selection) ...@@ -1125,7 +1119,7 @@ void LLScrollListCtrl::selectPrevItem( BOOL extend_selection)
} }
// don't allow navigation to disabled elements // don't allow navigation to disabled elements
prev_item = (cur_item && cur_item->getEnabled()) ? cur_item : prev_item; prev_item = cur_item->getEnabled() ? cur_item : prev_item;
} }
} }
...@@ -1155,7 +1149,7 @@ void LLScrollListCtrl::selectNextItem( BOOL extend_selection) ...@@ -1155,7 +1149,7 @@ void LLScrollListCtrl::selectNextItem( BOOL extend_selection)
{ {
LLScrollListItem* cur_item = *iter; LLScrollListItem* cur_item = *iter;
if (cur_item && cur_item->getSelected()) if (cur_item->getSelected())
{ {
if (next_item) if (next_item)
{ {
...@@ -1169,7 +1163,7 @@ void LLScrollListCtrl::selectNextItem( BOOL extend_selection) ...@@ -1169,7 +1163,7 @@ void LLScrollListCtrl::selectNextItem( BOOL extend_selection)
} }
// don't allow navigation to disabled items // don't allow navigation to disabled items
next_item = (cur_item && cur_item->getEnabled()) ? cur_item : next_item; next_item = cur_item->getEnabled() ? cur_item : next_item;
} }
} }
...@@ -1258,11 +1252,6 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, BOO ...@@ -1258,11 +1252,6 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, BOO
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter; LLScrollListItem* item = *iter;
if (!item)
{
continue;
}
std::string item_text = item->getColumn(column)->getValue().asString(); // Only select enabled items with matching names std::string item_text = item->getColumn(column)->getValue().asString(); // Only select enabled items with matching names
if (!case_sensitive) if (!case_sensitive)
{ {
...@@ -1298,11 +1287,6 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen ...@@ -1298,11 +1287,6 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter; LLScrollListItem* item = *iter;
if (!item)
{
continue;
}
// Only select enabled items with matching names // Only select enabled items with matching names
LLScrollListCell* cellp = item->getColumn(getSearchColumn()); LLScrollListCell* cellp = item->getColumn(getSearchColumn());
BOOL select = cellp ? item->getEnabled() && ('\0' == cellp->getValue().asString()[0]) : FALSE; BOOL select = cellp ? item->getEnabled() && ('\0' == cellp->getValue().asString()[0]) : FALSE;
...@@ -1415,7 +1399,7 @@ BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected) ...@@ -1415,7 +1399,7 @@ BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected)
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter; LLScrollListItem* item = *iter;
if (item && item->getEnabled() && (item->getValue().asString() == value.asString())) if (item->getEnabled() && (item->getValue().asString() == value.asString()))
{ {
if (selected) if (selected)
{ {
...@@ -1444,7 +1428,7 @@ BOOL LLScrollListCtrl::isSelected(const LLSD& value) const ...@@ -1444,7 +1428,7 @@ BOOL LLScrollListCtrl::isSelected(const LLSD& value) const
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem* item = *iter; LLScrollListItem* item = *iter;
if (item && item->getValue().asString() == value.asString()) if (item->getValue().asString() == value.asString())
{ {
return item->getSelected(); return item->getSelected();
} }
...@@ -1513,10 +1497,6 @@ void LLScrollListCtrl::drawItems() ...@@ -1513,10 +1497,6 @@ void LLScrollListCtrl::drawItems()
for (S32 line = first_line; line <= last_line; line++) for (S32 line = first_line; line <= last_line; line++)
{ {
LLScrollListItem* item = mItemList[line]; LLScrollListItem* item = mItemList[line];
if (!item)
{
continue;
}
item_rect.setOriginAndSize( item_rect.setOriginAndSize(
x, x,
...@@ -2115,7 +2095,7 @@ LLScrollListItem* LLScrollListCtrl::hitItem( S32 x, S32 y ) ...@@ -2115,7 +2095,7 @@ LLScrollListItem* LLScrollListCtrl::hitItem( S32 x, S32 y )
LLScrollListItem* item = *iter; LLScrollListItem* item = *iter;
if( mScrollLines <= line && line < mScrollLines + num_page_lines ) if( mScrollLines <= line && line < mScrollLines + num_page_lines )
{ {
if(item && item->getEnabled() && item_rect.pointInRect( x, y ) ) if( item->getEnabled() && item_rect.pointInRect( x, y ) )
{ {
hit_item = item; hit_item = item;
break; break;
...@@ -2408,28 +2388,26 @@ BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char) ...@@ -2408,28 +2388,26 @@ BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char)
while(iter != start_iter) while(iter != start_iter)
{ {
LLScrollListItem* item = *iter; LLScrollListItem* item = *iter;
if (item)
LLScrollListCell* cellp = item->getColumn(getSearchColumn());
if (cellp)
{ {
LLScrollListCell* cellp = item->getColumn(getSearchColumn()); // Only select enabled items with matching first characters
if (cellp) LLWString item_label = utf8str_to_wstring(cellp->getValue().asString());
if (item->getEnabled() && LLStringOps::toLower(item_label[0]) == uni_char)
{ {
// Only select enabled items with matching first characters selectItem(item);
LLWString item_label = utf8str_to_wstring(cellp->getValue().asString()); mNeedsScroll = true;
if (item->getEnabled() && LLStringOps::toLower(item_label[0]) == uni_char) cellp->highlightText(0, 1);
{ mSearchTimer.reset();
selectItem(item);
mNeedsScroll = true;
cellp->highlightText(0, 1);
mSearchTimer.reset();
if (mCommitOnKeyboardMovement
&& !mCommitOnSelectionChange)
{
onCommit();
}
break; if (mCommitOnKeyboardMovement
&& !mCommitOnSelectionChange)
{
onCommit();
} }
break;
} }
} }
...@@ -2747,7 +2725,7 @@ void LLScrollListCtrl::selectAll() ...@@ -2747,7 +2725,7 @@ void LLScrollListCtrl::selectAll()
for (iter = mItemList.begin(); iter != mItemList.end(); iter++) for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{ {
LLScrollListItem *itemp = *iter; LLScrollListItem *itemp = *iter;
if(itemp && itemp->getEnabled() ) if( itemp->getEnabled() )
{ {
selectItem(itemp, FALSE); selectItem(itemp, FALSE);
} }
...@@ -2879,13 +2857,11 @@ void LLScrollListCtrl::onClickColumn(void *userdata) ...@@ -2879,13 +2857,11 @@ void LLScrollListCtrl::onClickColumn(void *userdata)
S32 column_index = info->mIndex; S32 column_index = info->mIndex;
LLScrollListColumn* column = parent->mColumnsIndexed[info->mIndex]; LLScrollListColumn* column = parent->mColumnsIndexed[info->mIndex];
if (!column) return;
bool ascending = column->mSortDirection == LLScrollListColumn::ASCENDING; bool ascending = column->mSortDirection == LLScrollListColumn::ASCENDING;
if (column->mSortingColumn != column->mName if (column->mSortingColumn != column->mName
&& parent->mColumns.find(column->mSortingColumn) != parent->mColumns.end()) && parent->mColumns.find(column->mSortingColumn) != parent->mColumns.end())
{ {
LLScrollListColumn* info_redir = parent->mColumns[column->mSortingColumn]; LLScrollListColumn* info_redir = parent->mColumns[column->mSortingColumn];
if (!info_redir) return;
column_index = info_redir->mIndex; column_index = info_redir->mIndex;
} }
......
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