summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-17 12:34:00 +0000
committerrubidium <rubidium@openttd.org>2009-09-17 12:34:00 +0000
commit1f1161f10d1c409508445db2b03e531f6ad0df98 (patch)
treec1425f15db2ec99591817f81c2a2d6120058cd3a /src
parent430ce1941871d71a3c8cf6259001a488bdfeb9da (diff)
downloadopenttd-1f1161f10d1c409508445db2b03e531f6ad0df98.tar.xz
(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
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_gui.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 5df30bb88..e0d6d16b8 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -236,8 +236,9 @@ private:
}
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 @@ struct NewGRFWindow : public Window {
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