diff --git a/Src/gui/disc_menu.cpp b/Src/gui/disc_menu.cpp index a5d0a40..7ba5d31 100644 --- a/Src/gui/disc_menu.cpp +++ b/Src/gui/disc_menu.cpp @@ -50,7 +50,7 @@ public: virtual void timeoutCallback() { if (!Gui::gui->cur_gameInfo->screenshot) - Gui::gui->cur_gameInfo->screenshot = TheC64->TheDisplay->SurfaceFromC64Display(); + Gui::gui->cur_gameInfo->setScreenshot(TheC64->TheDisplay->SurfaceFromC64Display()); delete this; } diff --git a/Src/gui/game_info.cpp b/Src/gui/game_info.cpp index b0df778..3fb3838 100644 --- a/Src/gui/game_info.cpp +++ b/Src/gui/game_info.cpp @@ -210,3 +210,10 @@ void GameInfo::setName(const char *name) free((void*)this->name); this->name = xstrdup(name); } + + +void GameInfo::setScreenshot(SDL_Surface *scr) +{ + SDL_FreeSurface(this->screenshot); + this->screenshot = scr; +} diff --git a/Src/gui/game_info.hh b/Src/gui/game_info.hh index 96138be..0a6d855 100644 --- a/Src/gui/game_info.hh +++ b/Src/gui/game_info.hh @@ -33,6 +33,8 @@ public: void setName(const char *name); + void setScreenshot(SDL_Surface *scr); + void resetDefaults(); /** Returns an allocated dump structure */ diff --git a/Src/gui/game_info_menu.cpp b/Src/gui/game_info_menu.cpp index 0953850..bcd167b 100644 --- a/Src/gui/game_info_menu.cpp +++ b/Src/gui/game_info_menu.cpp @@ -41,7 +41,7 @@ public: switch (which) { case 0: - this->box->gi->screenshot = TheC64->TheDisplay->SurfaceFromC64Display();; + this->box->gi->setScreenshot(TheC64->TheDisplay->SurfaceFromC64Display()); break; case 2: case 3: @@ -65,7 +65,7 @@ public: { SDL_Surface *p = TheC64->TheDisplay->SurfaceFromC64Display(); - this->box->gi->screenshot = p; + this->box->gi->setScreenshot(p); } Gui::gui->popView(); }