Fix crash upon selecting a stamp too quickly
SaveButton relies on the SaveFile/SaveInfo passed to it at construction being alive until its destruction, or at least while it's being ticked (while its Tick is being called). While SaveButtons are owned by views, SaveFiles/SaveInfos associated with them are owned by models, so models need to immediately notify views (their observers) of changes made to SaveFiles/SaveInfos, or otherwise prevent views (and thus SaveButtons) from accessing stale SaveFile/SaveInfo pointers. The online save browser model (SearchModel) correctly notifies its observer (SearchView) about changes to its list of SaveInfos. The local save browser (FileBrowserActivity) is not MVC and simply either fully exits when its SaveFile list changes, or it cleans up its SaveButtons beforehand. The stamp browser model (LocalBrowerModel), however, would make changes to its SaveFile list without notifying its observer (LocalBrowserView) when selecting a stamp, so the latter might tick its SaveButtons after SaveFiles associated with them had already been cleaned up. This commit adds the missing notification. The crash would manifest when the SaveFile associated with a stamp was accessed for the GameSave it owned to be sent off for rendering with ThumbnailRendererTask.
This commit is contained in:
parent
c1c1daa9e5
commit
d56e8387cf
@ -59,6 +59,8 @@ void LocalBrowserModel::OpenSave(int index)
|
||||
{
|
||||
stamp = std::move(savesList[index]);
|
||||
savesList.clear();
|
||||
notifyPageChanged();
|
||||
notifySavesListChanged();
|
||||
}
|
||||
|
||||
bool LocalBrowserModel::GetMoveToFront()
|
||||
|
Loading…
Reference in New Issue
Block a user