1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Fixed crashbug in infoWindows.

This commit is contained in:
Michał W. Urbańczyk
2008-01-27 14:07:51 +00:00
parent 19c1fee418
commit 9b805ea1e7
2 changed files with 5 additions and 0 deletions

View File

@@ -281,6 +281,7 @@ CInfoWindow::CInfoWindow()
{ {
okb.ourObj = this; okb.ourObj = this;
okb.delg = this; okb.delg = this;
okb.notFreeButton=true;
} }
void CInfoWindow::okClicked(tribool down) void CInfoWindow::okClicked(tribool down)
@@ -561,11 +562,14 @@ CButtonBase::CButtonBase()
type=-1; type=-1;
abs=false; abs=false;
active=false; active=false;
notFreeButton = false;
ourObj=NULL; ourObj=NULL;
state=0; state=0;
} }
CButtonBase::~CButtonBase() CButtonBase::~CButtonBase()
{ {
if(notFreeButton)
return;
for(int i =0; i<imgs.size();i++) for(int i =0; i<imgs.size();i++)
for(int j=0;j<imgs[i].size();j++) for(int j=0;j<imgs[i].size();j++)
SDL_FreeSurface(imgs[i][j]); SDL_FreeSurface(imgs[i][j]);

View File

@@ -47,6 +47,7 @@ public:
int type; //advmapbutton=2 int type; //advmapbutton=2
bool abs; bool abs;
bool active; bool active;
bool notFreeButton;
CIntObject * ourObj; // "owner" CIntObject * ourObj; // "owner"
int state; int state;
std::vector< std::vector<SDL_Surface*> > imgs; std::vector< std::vector<SDL_Surface*> > imgs;