summaryrefslogtreecommitdiff
path: root/src/order_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2015-10-30 17:23:16 +0000
committerfrosch <frosch@openttd.org>2015-10-30 17:23:16 +0000
commit44d1fc42530a304e501e4f41ff0c26bf19971e6a (patch)
tree321494b2a6ebe132fd06f989890aa7b4904dc4de /src/order_gui.cpp
parentc0a301ae606cc877a0092e8fef6b14e53e46d4fc (diff)
downloadopenttd-44d1fc42530a304e501e4f41ff0c26bf19971e6a.tar.xz
(svn r27425) -Fix [FS#5842]: Crash when switching to or taking over companies, when an order window of a vehicle of the new company was opened. Now close those windows.
Diffstat (limited to 'src/order_gui.cpp')
-rw-r--r--src/order_gui.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index d4feae35c..3ca29e087 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -1713,6 +1713,12 @@ void ShowOrdersWindow(const Vehicle *v)
DeleteWindowById(WC_VEHICLE_TIMETABLE, v->index, false);
if (BringWindowToFrontById(WC_VEHICLE_ORDERS, v->index) != NULL) return;
+ /* Using a different WindowDescs for _local_company causes problems.
+ * Due to this we have to close order windows in ChangeWindowOwner/DeleteCompanyWindows,
+ * because we cannot change switch the WindowDescs and keeping the old WindowDesc results
+ * in crashed due to missing widges.
+ * TODO Rewrite the order GUI to not use different WindowDescs.
+ */
if (v->owner != _local_company) {
new OrdersWindow(&_other_orders_desc, v);
} else {