Changeset - r9393:a18c5f13f1f9
[Not reviewed]
master
0 1 0
smatz - 16 years ago 2008-05-27 23:40:36
smatz@openttd.org
(svn r13304) -Fix (r13042): possible double free (showed up in r13092)
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/misc_gui.cpp
Show inline comments
 
@@ -1084,26 +1084,27 @@ struct QueryStringWindow : public QueryS
 
		EventState state;
 
		switch (this->HandleEditBoxKey(QUERY_STR_WIDGET_TEXT, key, keycode, state)) {
 
			case 1: this->OnOk(); // Enter pressed, confirms change
 
			/* FALL THROUGH */
 
			case 2: delete this; break; // ESC pressed, closes window, abandons changes
 
		}
 
		return state;
 
	}
 

	
 
	~QueryStringWindow()
 
	{
 
		if (!this->handled && this->parent != NULL) {
 
			this->handled = true;
 
			this->parent->OnQueryTextFinished(NULL);
 
			Window *parent = this->parent;
 
			this->parent = NULL; // so parent doesn't try to delete us again
 
			parent->OnQueryTextFinished(NULL);
 
		}
 
		ClrBit(_no_scroll, SCROLL_EDIT);
 
	}
 
};
 

	
 
static const Widget _query_string_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,        STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,   RESIZE_NONE,    14,    11,   259,     0,    13, STR_012D,        STR_NULL},
 
{      WWT_PANEL,   RESIZE_NONE,    14,     0,   259,    14,    29, 0x0,             STR_NULL},
 
{    WWT_EDITBOX,   RESIZE_NONE,    14,     2,   257,    16,    27, 0x0,             STR_NULL},
 
{    WWT_TEXTBTN,   RESIZE_NONE,    14,     0,   129,    30,    41, STR_012E_CANCEL, STR_NULL},
 
{    WWT_TEXTBTN,   RESIZE_NONE,    14,   130,   259,    30,    41, STR_012F_OK,     STR_NULL},
0 comments (0 inline, 0 general)