summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-10 21:35:20 +0000
committerrubidium <rubidium@openttd.org>2008-05-10 21:35:20 +0000
commit3749323e231a9778d0ed882e08c7f58dccd90f67 (patch)
tree4c7543b953251584a6da8f17bbc689d5ac66416b /src
parentd41f3def5cc73c91848a37caa6925b46d3db5028 (diff)
downloadopenttd-3749323e231a9778d0ed882e08c7f58dccd90f67.tar.xz
(svn r13034) -Fix: segmentation fault due do double delete when closing the OSK window in some cases.
Diffstat (limited to 'src')
-rw-r--r--src/osk_gui.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp
index f92bb16b0..432c207bf 100644
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -166,12 +166,13 @@ static void OskWndProc(Window *w, WindowEvent *e)
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 */