xbmc/xbmc — pull request #1985 by Voyager1 (2012-12-25 08:35:36+00:00)
Title: fix wrong recreated history causing wrong sort order (viewstate not foun...

...d in db)

This issue fixes trac http://trac.xbmc.org/ticket/13777
CGUIMediaWindow::SetHistoryForPath "recreates" a history for use by the back key in case we jump right into a given path. For example if we jump to videodb://2/2/7/-2/?tvshowid=7 (an actual example from my tests) then SetHistoryForPath is constructing a history like this: videodb://2/2/7/?tvshowid=7; videodb://2/2/?tvshowid=7; videodb://2/?tvshowid=7; videodb://?tvshowid=7. The option part (after the ?) is maintained since URIUtils::GetParentPath does only modify the middle part (file). The consequence of this is that when using back, we're looking for the wrong saved viewstate, hence the sort order changes from what was originally set.

The obvious solution is to clear the option part when getting the parent path (only in the condition of being called by SetHistoryForPath). This does not seem to be dangerous, for the reason that it only affects the "recreated history" when accessing a library path directly.