Commits

Paul ProductEngine committed bd3bb90

STORM-659 FIXED Viewer hangs when navigate in the Back/Fwd Teleport history by keyboard

Reason:
If user didn't set number of max scrollable items (msi) then msi = U32_MAX

Solution:
If user didn't set number of msi then number of scrollable items = number of items in menu.

Comments (0)

Files changed (1)

indra/llui/llmenugl.cpp

 	{
 		item_list_t::reverse_iterator first_visible_item_iter = mItems.rend();
 
+		// Need to scroll through number of actual existing items in menu.
+		// Otherwise viewer will hang for a time needed to scroll U32_MAX
+		// times in std::advance(). STORM-659.
+		size_t nitems = mItems.size();
+		U32 scrollable_items = nitems < mMaxScrollableItems ? nitems : mMaxScrollableItems;
+
 		// Advance by mMaxScrollableItems back from the end of the list
 		// to make the last item visible.
-		std::advance(first_visible_item_iter, mMaxScrollableItems);
+		std::advance(first_visible_item_iter, scrollable_items);
 		mFirstVisibleItem = *first_visible_item_iter;
 		break;
 	}