浏览代码

Fixed crashbug in infoWindows.

Michał W. Urbańczyk 18 年之前
父节点
当前提交
9b805ea1e7
共有 2 个文件被更改,包括 5 次插入0 次删除
  1. 4 0
      CPlayerInterface.cpp
  2. 1 0
      CPlayerInterface.h

+ 4 - 0
CPlayerInterface.cpp

@@ -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]);

+ 1 - 0
CPlayerInterface.h

@@ -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;