changeset 9171:3e244c8df56d draft

(svn r13034) -Fix: segmentation fault due do double delete when closing the OSK window in some cases.
author rubidium <rubidium@openttd.org>
date Sat, 10 May 2008 21:35:20 +0000
parents 8c020e980b8c
children 14d58b9df009
files src/osk_gui.cpp
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -166,12 +166,13 @@
 				case OSK_WIDGET_CANCEL:
 					if (WP(w, osk_d).cancel_btn != 0) { // pass a cancel event to the parent window
 						w->parent->OnClick(e->we.click.pt, WP(w, osk_d).cancel_btn);
+						/* Window gets deleted when the parent window removes itself. */
 					} else { // or reset to original string
 						strcpy(qs->text.buf, WP(w, osk_d).orig);
 						UpdateTextBufferSize(&qs->text);
 						MoveTextBufferPos(&qs->text, WKC_END);
+						delete w;
 					}
-					delete w;
 					break;
 			}
 			/* make sure that the parent window's textbox also gets updated */