1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-06 09:39:49 +00:00

Use std::unique_ptr in SpellWindow

This commit is contained in:
Evil Eye 2022-08-31 19:50:30 +02:00
parent 6d65885bd2
commit 1b9da77455
2 changed files with 4 additions and 8 deletions

View File

@ -34,7 +34,7 @@ namespace MWGui
, mSpellView(nullptr) , mSpellView(nullptr)
, mUpdateTimer(0.0f) , mUpdateTimer(0.0f)
{ {
mSpellIcons = new SpellIcons(); mSpellIcons = std::make_unique<SpellIcons>();
MyGUI::Widget* deleteButton; MyGUI::Widget* deleteButton;
getWidget(deleteButton, "DeleteSpellButton"); getWidget(deleteButton, "DeleteSpellButton");
@ -54,11 +54,6 @@ namespace MWGui
mFilterEdit->setSize(filterWidth, mFilterEdit->getSize().height); mFilterEdit->setSize(filterWidth, mFilterEdit->getSize().height);
} }
SpellWindow::~SpellWindow()
{
delete mSpellIcons;
}
void SpellWindow::onPinToggled() void SpellWindow::onPinToggled()
{ {
Settings::Manager::setBool("spells pin", "Windows", mPinned); Settings::Manager::setBool("spells pin", "Windows", mPinned);

View File

@ -1,6 +1,8 @@
#ifndef MWGUI_SPELLWINDOW_H #ifndef MWGUI_SPELLWINDOW_H
#define MWGUI_SPELLWINDOW_H #define MWGUI_SPELLWINDOW_H
#include <memory>
#include "windowpinnablebase.hpp" #include "windowpinnablebase.hpp"
#include "spellmodel.hpp" #include "spellmodel.hpp"
@ -14,7 +16,6 @@ namespace MWGui
{ {
public: public:
SpellWindow(DragAndDrop* drag); SpellWindow(DragAndDrop* drag);
virtual ~SpellWindow();
void updateSpells(); void updateSpells();
@ -41,7 +42,7 @@ namespace MWGui
void onOpen() override; void onOpen() override;
SpellView* mSpellView; SpellView* mSpellView;
SpellIcons* mSpellIcons; std::unique_ptr<SpellIcons> mSpellIcons;
MyGUI::EditBox* mFilterEdit; MyGUI::EditBox* mFilterEdit;
private: private: