changeset 13061:6e313cb3553a draft

(svn r17559) -Fix [FS#3206]: close the "Add NewGRF" window when you close the "NewGRF Settings" window. The add window has a pointer to the settings which means that not deleting it would cause dereferencing an already freed pointer
author rubidium <rubidium@openttd.org>
date Thu, 17 Sep 2009 12:34:00 +0000
parents 0ea9c5ed1b7a
children a42c0f74d81d
files src/newgrf_gui.cpp
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -236,8 +236,9 @@
 	}
 
 public:
-	NewGRFAddWindow(const WindowDesc *desc, GRFConfig **list) : QueryStringBaseWindow(EDITBOX_MAX_SIZE)
+	NewGRFAddWindow(const WindowDesc *desc, Window *parent, GRFConfig **list) : QueryStringBaseWindow(EDITBOX_MAX_SIZE)
 	{
+		this->parent = parent;
 		this->InitNested(desc, 0);
 
 		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, EDITBOX_MAX_LENGTH);
@@ -731,7 +732,7 @@
 
 			case SNGRFS_ADD: // Add GRF
 				DeleteWindowByClass(WC_SAVELOAD);
-				new NewGRFAddWindow(&_newgrf_add_dlg_desc, &this->list);
+				new NewGRFAddWindow(&_newgrf_add_dlg_desc, this, &this->list);
 				break;
 
 			case SNGRFS_REMOVE: { // Remove GRF