1
0
Fork 0

(svn r22248) -Codechange: Make OnInvalidateData() process 'delete this;' already in command scope.

release/1.2
frosch 2011-03-13 21:34:49 +00:00
parent 652c9cb663
commit 141f2eba50
3 changed files with 2 additions and 4 deletions

View File

@ -189,12 +189,13 @@ struct AIListWindow : public Window {
*/ */
virtual void OnInvalidateData(int data = 0, bool gui_scope = true) virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{ {
if (!gui_scope) return;
if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) { if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) {
delete this; delete this;
return; return;
} }
if (!gui_scope) return;
this->vscroll->SetCount((int)this->ai_info_list->size() + 1); this->vscroll->SetCount((int)this->ai_info_list->size() + 1);
/* selected goes from -1 .. length of ai list - 1. */ /* selected goes from -1 .. length of ai list - 1. */
@ -450,7 +451,6 @@ struct AISettingsWindow : public Window {
*/ */
virtual void OnInvalidateData(int data = 0, bool gui_scope = true) virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{ {
if (!gui_scope) return;
if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) delete this; if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) delete this;
} }
}; };

View File

@ -652,7 +652,6 @@ public:
*/ */
virtual void OnInvalidateData(int data = 0, bool gui_scope = true) virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{ {
if (!gui_scope) return;
/* If company gets shut down, while displaying an error about it, remove the error message. */ /* If company gets shut down, while displaying an error about it, remove the error message. */
if (this->face != INVALID_COMPANY && !Company::IsValidID(this->face)) delete this; if (this->face != INVALID_COMPANY && !Company::IsValidID(this->face)) delete this;
} }

View File

@ -538,7 +538,6 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
*/ */
virtual void OnInvalidateData(int data = 0, bool gui_scope = true) virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
{ {
if (!gui_scope) return;
if (data == this->dest) delete this; if (data == this->dest) delete this;
} }
}; };