(svn r13034) -Fix: segmentation fault due do double delete when closing the OSK window in some cases.
authorrubidium
Sat, 10 May 2008 21:35:20 +0000
changeset 10491 39a3e4dc217f
parent 10490 e24144bd48c9
child 10492 25ee8db4551e
(svn r13034) -Fix: segmentation fault due do double delete when closing the OSK window in some cases.
src/osk_gui.cpp
--- a/src/osk_gui.cpp	Sat May 10 19:59:41 2008 +0000
+++ b/src/osk_gui.cpp	Sat May 10 21:35:20 2008 +0000
@@ -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 */