When what we need is a shared_ptr, we should just go ahead and use one.

One of the top crashes reported in the Play Console is a ManagedTexture crash, so seeing if this might help.
This commit is contained in:
Henrik Rydgård committed 2017-05-18 13:28:56 +02:00
1 parent 60378a0dcb
commit df6ce90c84
16 files changed
+73 -81

No files matched your search

+3 -4
View File
@@ -175,7 +175,7 @@ private:
};
void GameButton::Draw(UIContext &dc) {
GameInfo *ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath_, 0);
std::shared_ptr<GameInfo> ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath_, 0);
Draw::Texture *texture = 0;
u32 color = 0, shadowColor = 0;
using namespace UI;
@@ -1008,7 +1008,7 @@ void MainScreen::DrawBackground(UIContext &dc) {
bool MainScreen::DrawBackgroundFor(UIContext &dc, const std::string &gamePath, float progress) {
dc.Flush();
GameInfo *ginfo = 0;
std::shared_ptr<GameInfo> ginfo;
if (!gamePath.empty()) {
ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath, GAMEINFO_WANTBG);
// Loading texture data may bind a texture.
@@ -1042,8 +1042,7 @@ UI::EventReturn MainScreen::OnGameSelected(UI::EventParams &e) {
#else
std::string path = e.s;
#endif
GameInfo *ginfo = 0;
ginfo = g_gameInfoCache->GetInfo(nullptr, path, GAMEINFO_WANTBG);
std::shared_ptr<GameInfo> ginfo = g_gameInfoCache->GetInfo(nullptr, path, GAMEINFO_WANTBG);
if (ginfo && ginfo->fileType == IdentifiedFileType::PSP_SAVEDATA_DIRECTORY) {
return UI::EVENT_DONE;
}