mirror of https://github.com/OpenTTD/OpenTTD
(svn r13034) -Fix: segmentation fault due do double delete when closing the OSK window in some cases.
parent
d41f3def5c
commit
3749323e23
|
@ -166,12 +166,13 @@ static void OskWndProc(Window *w, WindowEvent *e)
|
||||||
case OSK_WIDGET_CANCEL:
|
case OSK_WIDGET_CANCEL:
|
||||||
if (WP(w, osk_d).cancel_btn != 0) { // pass a cancel event to the parent window
|
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);
|
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
|
} else { // or reset to original string
|
||||||
strcpy(qs->text.buf, WP(w, osk_d).orig);
|
strcpy(qs->text.buf, WP(w, osk_d).orig);
|
||||||
UpdateTextBufferSize(&qs->text);
|
UpdateTextBufferSize(&qs->text);
|
||||||
MoveTextBufferPos(&qs->text, WKC_END);
|
MoveTextBufferPos(&qs->text, WKC_END);
|
||||||
|
delete w;
|
||||||
}
|
}
|
||||||
delete w;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* make sure that the parent window's textbox also gets updated */
|
/* make sure that the parent window's textbox also gets updated */
|
||||||
|
|
Loading…
Reference in New Issue