From 135ad755b18520a98df9773bde76d94f70b9aaf4 Mon Sep 17 00:00:00 2001 From: Aloshi Date: Mon, 2 Jun 2014 14:33:27 -0500 Subject: [PATCH] Fix editing metadata in a nested folder causing back button to stop working. --- src/views/gamelist/BasicGameListView.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/views/gamelist/BasicGameListView.cpp b/src/views/gamelist/BasicGameListView.cpp index a45916614..3cf3eccc0 100644 --- a/src/views/gamelist/BasicGameListView.cpp +++ b/src/views/gamelist/BasicGameListView.cpp @@ -58,6 +58,26 @@ void BasicGameListView::setCursor(FileData* cursor) { populateList(cursor->getParent()->getChildren()); mList.setCursor(cursor); + + // update our cursor stack in case our cursor just got set to some folder we weren't in before + if(mCursorStack.empty() || mCursorStack.top() != cursor->getParent()) + { + std::stack tmp; + FileData* ptr = cursor->getParent(); + while(ptr && ptr != mRoot) + { + tmp.push(ptr); + ptr = ptr->getParent(); + } + + // flip the stack and put it in mCursorStack + mCursorStack = std::stack(); + while(!tmp.empty()) + { + mCursorStack.push(tmp.top()); + tmp.pop(); + } + } } }