Fixed memory leak when closing down windows.

master
sigonasr2 1 year ago
parent cb4a564c48
commit b4b4d59a88
  1. 1
      FiestaOnlineEditor/FiestaOnlineEditor.cpp
  2. 2
      FiestaOnlineEditor/ItemEditor.cpp
  3. 1
      FiestaOnlineEditor/ItemEditor.h
  4. 2
      FiestaOnlineEditor/Window.cpp
  5. 1
      FiestaOnlineEditor/Window.h

@ -186,6 +186,7 @@ bool FiestaOnlineEditor::OnUserUpdate(float fElapsedTime){
focusErased=true; focusErased=true;
} }
w->Cleanup(); w->Cleanup();
delete w;
return true; return true;
} else { } else {
return false; return false;

@ -3,6 +3,8 @@
ItemEditor::ItemEditor(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size) ItemEditor::ItemEditor(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size)
:Window(pge,windowTitle,pos,size){} :Window(pge,windowTitle,pos,size){}
ItemEditor::~ItemEditor(){};
void ItemEditor::Load(std::string basePath){ void ItemEditor::Load(std::string basePath){
ItemInfo.Load(basePath+"/ItemInfo.shn"); ItemInfo.Load(basePath+"/ItemInfo.shn");
} }

@ -10,6 +10,7 @@ class ItemEditor:public Window{
vf2d pos={64,64}; vf2d pos={64,64};
public: public:
ItemEditor(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size); ItemEditor(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size);
~ItemEditor();
void Load(std::string basePath); void Load(std::string basePath);
void Refresh(FiestaOnlineEditor*pge)override; void Refresh(FiestaOnlineEditor*pge)override;
void Update(FiestaOnlineEditor*pge,float fElapsedTime)override; void Update(FiestaOnlineEditor*pge,float fElapsedTime)override;

@ -10,6 +10,8 @@ Window::Window(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size
//InternalRefresh(pge); //InternalRefresh(pge);
} }
Window::~Window(){};
void Window::InternalUpdate(FiestaOnlineEditor*pge,float fElapsedTime){ void Window::InternalUpdate(FiestaOnlineEditor*pge,float fElapsedTime){
if(this==focusedWindow){ if(this==focusedWindow){
Update(pge,fElapsedTime); Update(pge,fElapsedTime);

@ -19,6 +19,7 @@ protected:
std::string windowTitle=""; std::string windowTitle="";
public: public:
Window(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size); Window(FiestaOnlineEditor*pge,std::string windowTitle,vi2d pos,vi2d size);
virtual ~Window();
void InternalUpdate(FiestaOnlineEditor*pge,float fElapsedTime); void InternalUpdate(FiestaOnlineEditor*pge,float fElapsedTime);
virtual void Update(FiestaOnlineEditor*pge,float fElapsedTime)=0; virtual void Update(FiestaOnlineEditor*pge,float fElapsedTime)=0;
virtual void Refresh(FiestaOnlineEditor*pge)=0; virtual void Refresh(FiestaOnlineEditor*pge)=0;

Loading…
Cancel
Save