summaryrefslogtreecommitdiff
path: root/train_gui.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2006-11-18 16:47:02 +0000
committerDarkvater <Darkvater@openttd.org>2006-11-18 16:47:02 +0000
commitc01c294afbcd9e75213be8ff569320889c1b793a (patch)
tree8112ec497b55f459780ad628193295c31cabfe28 /train_gui.c
parentb2a5b4f0693b010e90bcc2863c05d1c8629d920f (diff)
downloadopenttd-c01c294afbcd9e75213be8ff569320889c1b793a.tar.xz
(svn r7205) -Fix [FS#350, SF#1560913]: Window allocation and deletion messed with the actual window
structs inside their array, and possibly invalidating pointers higher up. Meaning that any function called within an wndproc could cause unknown/invalid pointers once control was returned to this function. Solved by the introduction of an extra abstraction layer, an array of z-window positions that is only concerned with the pointers.
Diffstat (limited to 'train_gui.c')
-rw-r--r--train_gui.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/train_gui.c b/train_gui.c
index 3c00d0d6e..ffb36ea4e 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -664,8 +664,7 @@ void ShowBuildTrainWindow(TileIndex tile)
DeleteWindowById(WC_BUILD_VEHICLE, tile);
- w = AllocateWindowDesc(&_new_rail_vehicle_desc);
- w->window_number = tile;
+ w = AllocateWindowDescFront(&_new_rail_vehicle_desc, tile);
w->vscroll.cap = 8;
w->widget[BUILD_TRAIN_WIDGET_LIST].data = (w->vscroll.cap << 8) + 1;