Use std::unique_ptr in MainMenu

crashfix_debugdraw
Evil Eye 2 years ago
parent 59fab4c9e2
commit 30d320f651

@ -28,7 +28,6 @@ namespace MWGui
, mBackground(nullptr)
, mVideoBackground(nullptr)
, mVideo(nullptr)
, mSaveGameDialog(nullptr)
{
getWidget(mVersionText, "VersionText");
mVersionText->setCaption(versionDescription);
@ -38,11 +37,6 @@ namespace MWGui
updateMenu();
}
MainMenu::~MainMenu()
{
delete mSaveGameDialog;
}
void MainMenu::onResChange(int w, int h)
{
mWidth = w;
@ -133,7 +127,7 @@ namespace MWGui
else
{
if (!mSaveGameDialog)
mSaveGameDialog = new SaveGameDialog();
mSaveGameDialog = std::make_unique<SaveGameDialog>();
if (name == "loadgame")
mSaveGameDialog->setLoadOrSave(true);
else if (name == "savegame")

@ -1,6 +1,8 @@
#ifndef OPENMW_GAME_MWGUI_MAINMENU_H
#define OPENMW_GAME_MWGUI_MAINMENU_H
#include <memory>
#include "windowbase.hpp"
namespace Gui
@ -30,7 +32,6 @@ namespace MWGui
public:
MainMenu(int w, int h, const VFS::Manager* vfs, const std::string& versionDescription);
~MainMenu();
void onResChange(int w, int h) override;
@ -61,7 +62,7 @@ namespace MWGui
void updateMenu();
SaveGameDialog* mSaveGameDialog;
std::unique_ptr<SaveGameDialog> mSaveGameDialog;
};
}

Loading…
Cancel
Save