Fix memory issues in homebrew store
Lots of problems in a few lines of code. We retained references to the filtered vector that lived temporarily in the load function... Plus, the "hidden" flag is utterly broken and could only ever work on the last entry, due to the above issue, and even then only if lucky. So I'm banning it from use, pointless anyway.
This commit is contained in:
parent
9317fbdd5e
commit
4c6f8d2b58
1 changed files with 4 additions and 7 deletions
11
UI/Store.cpp
11
UI/Store.cpp
|
@ -198,7 +198,7 @@ public:
|
|||
StoreEntry GetEntry() const { return entry_; }
|
||||
|
||||
private:
|
||||
const StoreEntry &entry_;
|
||||
const StoreEntry entry_;
|
||||
};
|
||||
|
||||
// This is a "details" view of a game. Lets you install it.
|
||||
|
@ -441,7 +441,7 @@ void StoreScreen::ParseListing(std::string json) {
|
|||
e.size = game.getInt("size");
|
||||
e.downloadURL = game.getString("download-url", "");
|
||||
e.iconURL = game.getString("icon-url", "");
|
||||
e.hidden = game.getBool("hidden", false);
|
||||
e.hidden = false; // NOTE: Handling of the "hidden" flag is broken in old versions of PPSSPP. Do not use.
|
||||
const char *file = game.getString("file", nullptr);
|
||||
if (!file)
|
||||
continue;
|
||||
|
@ -484,8 +484,7 @@ void StoreScreen::CreateViews() {
|
|||
scrollItemView_ = new LinearLayoutList(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT));
|
||||
leftScroll->Add(scrollItemView_);
|
||||
|
||||
std::vector<StoreEntry> entries = FilterEntries();
|
||||
for (size_t i = 0; i < entries.size(); i++) {
|
||||
for (size_t i = 0; i < entries_.size(); i++) {
|
||||
scrollItemView_->Add(new ProductItemView(entries_[i]))->OnClick.Handle(this, &StoreScreen::OnGameSelected);
|
||||
}
|
||||
|
||||
|
@ -511,9 +510,7 @@ void StoreScreen::CreateViews() {
|
|||
std::vector<StoreEntry> StoreScreen::FilterEntries() {
|
||||
std::vector<StoreEntry> filtered;
|
||||
for (size_t i = 0; i < entries_.size(); i++) {
|
||||
// TODO: Actually filter by category etc.
|
||||
if (!entries_[i].hidden)
|
||||
filtered.push_back(entries_[i]);
|
||||
filtered.push_back(entries_[i]);
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue